UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to <undefined>

Cameron Simpson cs at cskk.id.au
Fri Jun 8 18:26:10 EDT 2018


On 05Jun2018 06:42, bellcanadardp at gmail.com <bellcanadardp at gmail.com> wrote:
>On Sunday, 3 June 2018 20:11:43 UTC-4, Steven D'Aprano  wrote:
>> Don't retype a summary of what you think the error is. "character
>> undefieed" is not a thing, and there is no such thing as "byte 1x09".
>>
>> You need to COPY AND PASTE the EXACT error that you get. Not just the
>> last line, the error message, but the FULL TRACEBACK starting from the
>> line "Traceback" and going to the end.
[...]
>
>here is the exact error full message
>in the attachment...UPDATE..i am manually modifying this reply..i tried to answer by my gmail but i get errors and i couldnt find this webpage till today and it doesnt accept attachments..so many you can for future provide an email if thats ok...anyway i will write the error manually here:

Many of us read this group/list via the mailing list python-list at python.org.  
I've CCed it here. Just avoid Google Groups, they're an awful interface to both 
usenet and mailing lists.

>File 
>"C:\Users\Robert\AppData\Local\Programs\Python\Python36\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 0x9d in position 7414: character maps to <undefined>

As Steven has remarked, this is not the complete traceback he requested, just 
the end. We need to know the entire execution stack.

>for the record i did not puprosely set the code or decode o encode to cp-1252; 
>this is a 3rd party script i have from the internet thats all

Can you say where it came from and how you fetched it? That may affect how the 
file got into this situation and how it might be repaired.

It might also let us fetch the file ourselves to look at it.

>this a  set of files that runs find in python 2.7
>i am trying to run it in python 3 becuz i was told in 2020 python 2 will no longer be supported
>not sure if that really matters for my script

It may not matter, but as a general rule you should try to use Python 3 for new 
stuff. Python 2 is effectively end of life.

>it runs completey fine in python 2, so for me the issue is with python 3 and 
>its changes relative to python 2

It is possible that Python 2 is just glossing over the problem; Python 3 has a 
more rigorous view of character data.

Cheers,
Cameron Simpson <cs at cskk.id.au>



More information about the Python-list mailing list