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

Document PYTHONIOENCODING for UTF-8 IO handling #24

Merged
merged 1 commit into from
Jun 13, 2017

Conversation

jbyers
Copy link

@jbyers jbyers commented Jun 13, 2017

On Ubuntu 14.04 / python 2.7.6, we encountered the error below when a command emitted UTF-8. The solution was to signal to python that stdin/stdout/stderr were UTF-8 encoded by crontab environment variable:

PYTHONIOENCODING=utf8

This patch adds this as a note to the README.

Traceback (most recent call last):
  File "/usr/local/bin/cron-sentry", line 9, in <module>
    load_entry_point('cron-sentry==0.7.0', 'console_scripts', 'cron-sentry')()
  File "/usr/local/lib/python2.7/dist-packages/cron_sentry/runner.py", line 122, in run
    sys.exit(runner.run())
  File "/usr/local/lib/python2.7/dist-packages/cron_sentry/runner.py", line 159, in run
    sys.stdout.write(last_lines_stdout)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 175-268: ordinal not in range(128)

@hltbra hltbra merged commit ebdc27b into Yipit:master Jun 13, 2017
@hltbra
Copy link

hltbra commented Jun 13, 2017

Thanks for the documentation contribution, @jbyers!

@jbyers
Copy link
Author

jbyers commented Jun 13, 2017

No problem - thanks for the fast merge, and for the most useful utility.

hltbra added a commit that referenced this pull request Dec 12, 2017
hltbra added a commit that referenced this pull request Dec 12, 2017
* Configure root logger to log raven errors (#25)
* Document PYTHONIOENCODING for UTF-8 IO handling (#24)
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

Successfully merging this pull request may close these issues.

2 participants