Created
July 20, 2009 13:48
-
-
Save inky/150345 to your computer and use it in GitHub Desktop.
@AutoMeme woes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From: Cron Daemon | |
Date: Sun, 19 Jul 2009 06:15:04 +0100 (IST) | |
To: inky | |
Subject: Cron <inky> /home/inky/cron/automeme/twittermeme.py --cron >/dev/null | |
Traceback (most recent call last): | |
File "/home/inky/cron/automeme/twittermeme.py", line 102, in ? | |
main() | |
File "/home/inky/cron/automeme/twittermeme.py", line 91, in main | |
post() | |
File "/home/inky/cron/automeme/twittermeme.py", line 82, in post | |
print status.text | |
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2026' in position 82: ordinal not in range(128) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def to_unicode_or_bust(obj, encoding='utf-8'): | |
""" | |
http://farmdev.com/talks/unicode/ | |
""" | |
if isinstance(obj, basestring): | |
if not isinstance(obj, unicode): | |
obj = unicode(obj, encoding) | |
return obj |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment