Closed ekt1701 closed 7 years ago
Thank you for opening the issue! I'll dig into this and see what I can figure out.
Quick question, when you called redditwatcher
, which subreddits did you pass in as args? If you remember, of course. Thanks! 👍 😄
Yes it was the Python subreddit. Here is where it broke:
/r/Python [4/26 3:35 P] https://redd.it/67rln8
Pyparsing help.
/r/Python [4/26 6:19 P] https://redd.it/67si44
What's this sub about?
Traceback (most recent call last):
File "app.py", line 56, in <module>
main()
File "app.py", line 23, in main
display_submission(submission)
File "app.py", line 51, in display_submission
submission.title
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2014' in position 44: ordinal not in range(128)
Here is the title that caused the error:
100 Scripts in 30 Days challenge: Script 22 — Learning Some Python Basic Data Structures (Lists, Tuples, Numpy Arrays)
I get this error with Python 2.7
Ah, ok, I should've specified originally. This required python3! I think the unicode issues might be stemming from python2.
I think you probably installed this prior to me changing around the installation process 😢
My recommendation would be to:
pip uninstall .
in the redditwatcher directorygit fetch origin
git merge origin/master
./install
Hopefully that helps! Closing this for now, let me know if any other issues arise!
Actually, I didn't use the installation process, I'm running the app.py from the terminal and hard coded the subreddits.
BTW, I found a workaround for Python 2.7 I added the following lines and no more Unicode errors. :)
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
FYI, Also, I had to use these lines, otherwise, I was getting a key error.
reddit = praw.Reddit(client_id='REDDITWATCHER_CLIENTID',
client_secret='REDDITWATCHER_CLIENTSECRET',
user_agent='redditwatcher')
From time to time I get the following error:
Otherwise, this works great!