manolomartinez / greg

A command-line podcast aggregator
GNU General Public License v3.0
297 stars 37 forks source link

greg sync crashes when run from (f)cron #46

Closed josswright closed 8 years ago

josswright commented 8 years ago

I've got a simple greg sync running as a cron job (via fcron under Arch Linux). It works fine when I run it in the terminal, but when running as a cron job I get the following output:

Traceback (most recent call last): File "/usr/bin/greg", line 9, in load_entry_point('Greg==0.4.6', 'console_scripts', 'greg')() File "/usr/lib/python3.5/site-packages/greg/gregparser.py", line 118, in main function(vars(args)) File "/usr/lib/python3.5/site-packages/greg/greg.py", line 745, in sync session = Session(args) File "/usr/lib/python3.5/site-packages/greg/greg.py", line 55, in init self.data_dir = self.retrieve_data_directory() File "/usr/lib/python3.5/site-packages/greg/greg.py", line 95, in retrieve_data_directory config.read([config_filename_global, self.config_filename_user]) File "/usr/lib/python3.5/configparser.py", line 696, in read self._read(fp, filename) File "/usr/lib/python3.5/configparser.py", line 1012, in _read for lineno, line in enumerate(fp, start=1): File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 33: ordinal not in range(128)

manolomartinez commented 8 years ago

Hi, this is most likely because $LANG is not set in the cron environment. Try setting $LANG in your crontab file to whatever you get when doing echo $LANG in the terminal.

josswright commented 8 years ago

Excellent. Thank you!

manolomartinez commented 8 years ago

Check it out, and please close the issue if this solves it. I should probably add a troubleshooting section to the README...

josswright commented 8 years ago

Seems to work. Thank you! Annoyingly, when I checked, I had already had to do that for another cron job running a python script, so I really should have known already. (The other program was vdirsyncer, in case anyone stumbles across this.)