Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
josswright opened this issue Apr 6, 2016 · 4 comments
Closed

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

josswright opened this issue Apr 6, 2016 · 4 comments

Comments

@josswright
Copy link

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
Copy link
Owner

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
Copy link
Author

Excellent. Thank you!

@manolomartinez
Copy link
Owner

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

@josswright
Copy link
Author

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants