View Single Post
Old 09-22-2013, 03:33 AM   #10
oblongau
Member
oblongau began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Sep 2013
Location: Australia
Device: Calibre; Galaxy SII
Similar to jsambrook (#9) I get:

Code:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<string>", line 356, in main
  File "<string>", line 192, in prints
TypeError: encode() argument 1 must be string, not None
I have the file /home/bob/Documents/scripts/calibre-update.sh which is:
Code:
#!/bin/sh
python -c "import sys; py3 = sys.version_info[0] > 2; u = __import__('urllib.request' if py3 else 'urllib', fromlist=1); exec(u.urlopen('http://status.calibre-ebook.com/linux_installer').read()); main(install_dir='/opt')"
Using
Code:
sudo crontab -e
I create (changing the crontab times as needed, to test):
Code:
50 16 * * 0 /home/bob/Documents/scripts/calibre-update.sh > /home/bob/Documents/scripts/error.log 2>&1 &
(That error.log is where the error I mentioned at the beginning appears.)

I don't understand what jsambrook means by:

Code:
If after:

enc = getattr(f, 'encoding', 'utf-8')

I add:

if enc == None:
enc = "utf-8"
and if that (whatever it is) is a fix.

If I add "sudo" to before "python..." in the script and run it from a terminal where the script lives,
Quote:
./calibre-update.sh
then I am prompted for my password and it runs fine.

What am I doing wrong with my apparently simple method?

Any help appreciated.
oblongau is offline   Reply With Quote