-
Notifications
You must be signed in to change notification settings - Fork 35
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 #39
Comments
Similar issue - but with the " character (u201c) found somewhere: UnicodeEncodeError: 'ascii' codec can't encode character u'\u201c' in position 17: ordinal not in range(128) Edit 5/2/2017: pulled and tested the latest version - same issue, apparently somewhere else: UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 83: ordinal not in range(128) |
Use Python 3 and this error will clear up. If you have multiple versions of python installed use |
Thank you @admish for commenting here. Did you use the recent commit with #38? This could mean this issue can be closed alongside with already closed issue #37 without waiting response @netfortius and @nmandal. |
@rachmadaniHaryono I just installed this today so have only ever used the latest commit. Running Python 2.7.12 and Python 3.4.2 on macOS 10.12.4. Python3 with praw 4.5 ran flawlessly while Python 2.7 gave the following error:
|
Did you come the repo or just download the export_saved file? If you clone the repo can you check which commit you are now? I will add program version flag so people can easily recognize the version later. Also python2.7 is actually not officially supported (and we haven't wrote any python requirement in readme, sorry for that). But I will patch this python2.7 if the latest pr can't fix it.
|
Yes, I cloned the repo. By default, OS X comes with Python 2.7. Following the instructions in the README on Macs without knowing this, the script won't work. To anyone else reading this you can change the default version by editing your If this would help, here is the latest entry in the log. :~/Workspace/export-saved-reddit$ git log
commit 9841839e273bc8675bc7bb96112650957131fb6c
Merge: 8277d77 5d2ca4b
Author: Christopher Su <[email protected]>
Date: Wed Apr 26 19:51:43 2017 -0700
Merge pull request #38 from rachmadaniHaryono/feature/fix-csv-type-error
fix: usr: TypeError when writing csv field |
@admish can you check once again on python2.7 version? e: checkout the branch on the pr and run it once again. e2: actually on requirement it is already recommended to use python3
i recommend @netfortius and @nmandal can use python3 the next version i may add an error if python2 is used. |
Same error. |
on the same line? 254 or 256? |
|
Still the same error. Version 4.4.0 of praw is outdated. Version 4.5.1 was released 2 days ago.
Traceback (most recent call last):
File "export_saved.py", line 329, in <module>
main()
File "export_saved.py", line 323, in main
save_saved(reddit)
File "export_saved.py", line 287, in save_saved
process(reddit, seq, "export-saved", "Reddit - Saved")
File "export_saved.py", line 269, in process
write_csv(csv_rows, file_name + ".csv")
File "export_saved.py", line 246, in write_csv
csvwriter.writerow(row)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u201d' in position 68: ordinal not in range(128) The git pull was successful and this was on the latest merge. ## $ git log
commit 64a37f64037c3eec623ba16de962c7a5da35f1d5
Merge: 9841839 9d4d027
Author: rachmadani haryono <[email protected]>
Date: Mon May 8 06:51:03 2017 +0800
Merge pull request #42 from rachmadaniHaryono/feature/add-program-version
chg: dev: add program version. |
yeah, but that isn't the pull request branch. add my fork and checkout the branch.
this should be the result from git show
|
Traceback (most recent call last):
File "export_saved.py", line 339, in <module>
main()
File "export_saved.py", line 333, in main
save_saved(reddit)
File "export_saved.py", line 297, in save_saved
process(reddit, seq, "export-saved", "Reddit - Saved")
File "export_saved.py", line 279, in process
write_csv(csv_rows, file_name + ".csv")
File "export_saved.py", line 256, in write_csv
csvwriter.writerow(row.encode('utf8', 'ignore'))
AttributeError: 'list' object has no attribute 'encode' $ git log
commit c8cca7e5f2734d9afd41a05b75f470aafee0f1ce
Author: rachmadaniHaryono <[email protected]>
Date: Thu May 11 03:32:14 2017 +0800
chg: dev: fix variable typo |
Traceback (most recent call last):
File "export_saved.py", line 339, in <module>
main()
File "export_saved.py", line 333, in main
save_saved(reddit)
File "export_saved.py", line 297, in save_saved
process(reddit, seq, "export-saved", "Reddit - Saved")
File "export_saved.py", line 279, in process
write_csv(csv_rows, file_name + ".csv")
File "export_saved.py", line 256, in write_csv
csvwriter.writerow([x.encode('utf8', 'ignore') for x in row])
AttributeError: 'int' object has no attribute 'encode' |
Would you like me to setup an OS X VM for you? |
Setting up a new one now, but also about to leave work so give me a couple hours. In the meantime email me a public key that I can add into the authorized_keys file, and when I have the login info setup I'll share it so you can login. |
Issue is back, at least on OSX. Unicode error, regardless of version of python or praw used. Tried two different machines, one with python2 & praw 4.5.1, and one with python3 and praw 5.0.1. Then upgraded praw on the python2 machine, to cover that combo - consistent error across all: "can't encode character '\xe0' in position 66: ordinal not in range (128)" |
Fix for unicode errors and conversion process ref: csu#39
It looks like this issue wasn't resolved, so I have opened a PR. |
Iirc the 3 PRs are actually for this issue, yet nobody mention if the issue is already fixed by one of these |
You're right, it looks like there are 2 other PR requests that are in various states of completeness. It would be good to have a fix merged in for this issue so that others don't have to run into it. |
$ python export_saved.py
Traceback (most recent call last):
File "export_saved.py", line 305, in
main()
File "export_saved.py", line 299, in main
save_saved(reddit)
File "export_saved.py", line 267, in save_saved
process(reddit, seq, "export-saved", "Reddit - Saved")
File "export_saved.py", line 247, in process
csv_rows = get_csv_rows(reddit, seq)
File "export_saved.py", line 194, in get_csv_rows
logging.debug('title: {}'.format(title))
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2014' in position 90: ordinal not in range(128)
The text was updated successfully, but these errors were encountered: