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

UnicodeDecodeError #6

Open
seed78 opened this issue Feb 16, 2021 · 2 comments
Open

UnicodeDecodeError #6

seed78 opened this issue Feb 16, 2021 · 2 comments

Comments

@seed78
Copy link

seed78 commented Feb 16, 2021

Hello,

I tried to run the script with Python 3.8.1. But, I got this error. How could I solve it?

C:\citation map>python analyze_papers.py Library.csv

Traceback (most recent call last):
File "analyze_papers.py", line 233, in
titles_dict = read_titles(args.zotero_csv)
File "analyze_papers.py", line 77, in read_titles
for r in reader:
File "C:\Python38\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 1593: character maps to

@A-Fitz
Copy link

A-Fitz commented Apr 4, 2021

I solved this problem by manually setting the encoding for the open() function used when reading the titles from the Zotero CSV. Specifically, in the read_titles() function, update line 74 to the following (using whatever encoding your CSV uses):

with open(zotero_csv, 'rt', encoding='utf8') as csvfile:

@erdemunal35
Copy link

erdemunal35 commented May 26, 2021

Or just use the "Western" Character Encoding while exporting the .csv file in Zotero

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

3 participants