After update to version 1.6.1 a Unicode error start to happen.

Any SUBREDDIT with special characters like u'\xe3' are trigging an error at line 141, data['flair'] = '[{}]'.format(data['flair'].strip()) .
The solution was to add u'[{}]' to the string.
The original error message: UnicodeEncodeError: 'ascii' codec can't encode character u'\xe3' in position 7: ordinal not in range(128) .
This commit is contained in:
Marc Antonio Queiroz
2015-10-26 14:48:19 -02:00
parent 1ae97262de
commit 466af862b3

View File

@@ -138,7 +138,7 @@ class BaseContent(object):
data['index'] = None # This is filled in later by the method caller
if data['flair'] and not data['flair'].startswith('['):
data['flair'] = '[{}]'.format(data['flair'].strip())
data['flair'] = u'[{}]'.format(data['flair'].strip())
url_full = data['url_full']
if data['permalink'].split('/r/')[-1] == url_full.split('/r/')[-1]: