UnicodeEncodeError: 'latin-1' codec can't encode character '\u201d' in position 26: ordinal not in range(256)
See original GitHub issue[](import praw
from praw.models import MoreComments
reddit = praw.Reddit(user_agent='Comment Extraction (by /u/”username”)',client_id="XXXXXX", client_secret="XXX",username='iaXXX', password='AXXX')
submission = reddit.submission(url='https://www.reddit.com/r/ethtrader/comments/7pdp3g/daily_general_discussion_january_10_2018/?limit=500')
for top_level_comment in submission.comments:
print(top_level_comment.body))
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:9 (5 by maintainers)
Top Results From Across the Web
UnicodeEncodeError: 'latin-1' codec can't encode character
UnicodeEncodeError : 'latin-1' codec can't encode character '\u2013' in position 106: ordinal not in range(256). Solution 1: \u2013 - google the character ...
Read more >Server Error UnicodeEncodeError: 'latin-1' codec can't encode ...
Server Error UnicodeEncodeError: 'latin-1' codec can't encode characters in position 54-59: ordinal not in range(256).
Read more >UnicodeEncodeError: 'latin-1' codec can't encode characters ...
UnicodeEncodeError : 'latin-1' codec can't encode characters #1822 ... codec can't encode characters in position 1632-1633: ordinal not in range(256).
Read more >'latin-1' codec can't encode character 'u2026' in position 512 ...
UnicodeEncodeError : 'latin-1' codec can't encode character '\u2013' in position 83: ordinal not in range(256) ; 2. UnicodeEncodeError ; 4. 'He said \x93Hello\x94'....
Read more >Overcoming frustration: Correctly using unicode in python2
test.py", line 4, in <module> print u'café' UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 3: ordinal not in range(128) ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok never mind I resolved it. Just created a new app ie new client ID, secret and thats working. No clue why though, cause it has similar characters as the older one.
Remove
”
(U+201D) or replace it with"
(U+0022) then try again. Using non-ASCII characters for a user agent (or HTTP headers in general) may cause such error.