question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
2Nipuncommented, May 1, 2022

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.

1reaction
nmtakecommented, Apr 6, 2018
reddit = praw.Reddit(user_agent='Comment Extraction (by /u/”username”)', ...

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found