View Single Post
Old 08-01-2011, 04:09 PM   #31
pmiles
Member
pmiles began at the beginning.
 
Posts: 12
Karma: 10
Join Date: Aug 2011
Device: none
Hm... /bin/sh? I always had #!/bin/bash in my script. Here is the script:
Code:
#!/bin/bash

/usr/bin/python2.7 /opt/calibre/ebook-convert /home/calibre/recipes/economist.recipe economist.mobi --title="The Economist" --output-profile=kindle --username=xxxx --password=xxxx

calibre-smtp -r xxxx.com -e TLS --port 587 -u xxxx -p xxxx -a economist.mobi xxxx@xxxx.com xxxx@free.kindle.com Economist
Here is a crontab entry:
Code:
35 15 * * 4 /home/calibre/calibre-economist.sh >/dev/null 2>&1
This is how I execute the script manually and what I get:
Code:
sh calibre-economist.sh 
  File "/opt/calibre/ebook-convert", line 2
    path=`readlink -e $0`
                      ^
SyntaxError: invalid syntax
I've just found out something. I've just tested The Wall Street Journal recipe that was working perfectly under calibre 0.7.7 and python 2.6. So I tied it and got the same error:
Code:
       
calibre@kapiti:~$ /usr/bin/python2.7 /opt/calibre/ebook-convert /home/calibre/recipes/wsj.recipe wsj.mobi --title="The Wall Street Journal" --output-profile=kindle --username=xxxx --password=xxxx
  File "/opt/calibre/ebook-convert", line 2
    path=`readlink -e $0`
                      ^
SyntaxError: invalid syntax
Now, I tried it with python 2.6:
Code:
calibre@kapiti:~$ /opt/calibre/ebook-convert /home/calibre/recipes/wsj.recipe wsj.mobi --title="The Wall Street Journal" --output-profile=kindle --username=xxxx --password=xxxx

[...]

MOBI output written to /home/calibre/wsj.mobi
Output saved to   /home/calibre/wsj.mobi
It worked perfectly! Well, it posted some error like before, but non-critical:
Code:
Failed to download cover

[...]

Initial parse failed:
Parsing file 'feed_0/article_1/index.html' as HTML                                              
Forcing feed_0/article_1/index.html into XHTML namespace                                        
Initial parse failed:                                                                           
Parsing file 'feed_0/article_14/index.html' as HTML                                             
Forcing feed_0/article_14/index.html into XHTML namespace                                       
Initial parse failed:                                                                           
Parsing file 'feed_5/index.html' as HTML                                                        
Forcing feed_5/index.html into XHTML namespace                                                  
Initial parse failed:                                                                           
Parsing file 'feed_0/article_3/index.html' as HTML                                              
Forcing feed_0/article_3/index.html into XHTML namespace                                        
Initial parse failed:                                                                           
Parsing file 'feed_5/article_0/index.html' as HTML                                              
Forcing feed_5/article_0/index.html into XHTML namespace                                        
Initial parse failed:                                                                           
Parsing file 'feed_0/article_12/index.html' as HTML                                             
Forcing feed_0/article_12/index.html into XHTML namespace                                       
Initial parse failed:                                                                           
Parsing file 'feed_1/index.html' as HTML                                                        
Forcing feed_1/index.html into XHTML namespace                                                  
Initial parse failed:                                                                           
Parsing file 'feed_0/article_0/index.html' as HTML                                              
Forcing feed_0/article_0/index.html into XHTML namespace                                        
Initial parse failed:                                                                           
Parsing file 'feed_4/index.html' as HTML                                                        
Forcing feed_4/index.html into XHTML namespace                                                  
Initial parse failed:                                                                           
Parsing file 'feed_1/article_2/index.html' as HTML                                              
Forcing feed_1/article_2/index.html into XHTML namespace                                        
Initial parse failed:                                                                           
Parsing file 'feed_2/index.html' as HTML                                                        
Forcing feed_2/index.html into XHTML namespace                                                  
Initial parse failed:                                                                           
Parsing file 'feed_3/article_2/index.html' as HTML                                              
Forcing feed_3/article_2/index.html into XHTML namespace                                        
Initial parse failed:                                                                           
Parsing file 'feed_0/article_11/index.html' as HTML                                             
Forcing feed_0/article_11/index.html into XHTML namespace                                       
Initial parse failed:                                                                           
Parsing file 'feed_1/article_12/index.html' as HTML                                             
Forcing feed_1/article_12/index.html into XHTML namespace                                       
Initial parse failed:                                                                           
Parsing file 'feed_0/index.html' as HTML                                                        
Forcing feed_0/index.html into XHTML namespace                                                  
Initial parse failed:                                                                           
Parsing file 'feed_4/article_17/index.html' as HTML                                             
Forcing feed_4/article_17/index.html into XHTML namespace                                       
Initial parse failed:                                                                           
Parsing file 'feed_1/article_0/index.html' as HTML                                              
Forcing feed_1/article_0/index.html into XHTML namespace                                        
Initial parse failed:                                                                           
Parsing file 'feed_0/article_7/index.html' as HTML                                              
Forcing feed_0/article_7/index.html into XHTML namespace                                        
Initial parse failed:                                                                           
Parsing file 'feed_3/index.html' as HTML                                                        
Forcing feed_3/index.html into XHTML namespace               
Forcing index.html into XHTML namespace
So, somehow other recipes work either with python 2.6 or 2.7, either with calibre 0.7.7 or 0.8.12 or with any combination of python and calibre versions. However it seems that the new Economist recipes just doesn't want to work with either calibre or either python.

Quote:
Originally Posted by kovidgoyal View Post
What are you using for /bin/sh? Change the hashbang at the top of the launcher scripts to /bin/bash
pmiles is offline   Reply With Quote