Federico Perez
Federico Perez

Reputation: 11

Python Unicode Decode Error Using Package

I'm currently working on a data science package where you can analyze Whatsapp group information. Here is the link:https://github.com/aqeelanwar/AnalyzeTheChat/blob/master/README.md

I'm a beginner therefore I'm having some trouble with the last step where after entering this code

main.py --path C:\Users\Usuario\Downloads\Panas.txt --save_as pdf 

I'm getting a Unicode error message which I haven't been able to solve. I'm on a Windows 7, using anaconda on the cmd prompt.

Traceback (most recent call last):

File "main.py", line 81, in
process_chat(args.path)

File "main.py", line 42, in process_chat
chat = chat.read()

File "C:\Users\Usuario\anaconda3\envs\myenv1\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 0x8f in position 1769: character maps to

Upvotes: 1

Views: 103

Answers (1)

tk421
tk421

Reputation: 281

Python is treating the characters after the \U as Unicode. You can make Python treat the path like a string by putting another backslash before each backslash in the path, like C:\\Users\\Usuario.

Upvotes: 0

Related Questions