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

UnicodeEncodeError: 'ascii' codec can't encode character #54

Open
catlover99 opened this issue Nov 20, 2016 · 0 comments
Open

UnicodeEncodeError: 'ascii' codec can't encode character #54

catlover99 opened this issue Nov 20, 2016 · 0 comments

Comments

@catlover99
Copy link

When using word_freqs [username] [/u/username] --verbose
I ran into this error with out_text

Traceback (most recent call last): File "C:\Python27\Scripts\word_freqs-script.py", line 9, in <module> load_entry_point('redditanalysis==1.0.4', 'console_scripts', 'word_freqs')() File "c:\python27\lib\site-packages\redditanalysis\__init__.py", line 400, in main out_text = str("{0}:{1}\n".format(word, popular_words[word])) UnicodeEncodeError: 'ascii' codec can't encode character u'\u0296' in position 0: ordinal not in range(128)

Encoding late will solve this issue and both instances of out_text on lines 404 and 419 in

\lib\site-packages\redditanalysis\__init__.py

can be changed from

out_text = str("{0}:{1}\n".format(word, popular_words[word]))

to

out_text = str("{0}:{1}\n".format(word.encode('utf-8'), popular_words[word]))

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

1 participant