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

bellcanadardp at gmail.com bellcanadardp at gmail.com
Tue Jun 5 09:42:29 EDT 2018


On Sunday, 3 June 2018 20:11:43 UTC-4, Steven D'Aprano  wrote:
> On Sun, 03 Jun 2018 16:36:12 -0700, bellcanadardp wrote:
> 
> > hello peter ...how exactly would i solve this issue .....i have a script
> > that works in python 2 but not pytho3..i did 2 to 3.py ...but i still
> > get the errro...character undefieed..unicode decode error cant decode
> > byte 1x09 in line 7414 from cp 1252..like would you have a sraright
> > solution answer??..i cant get a straight answer..it was ported from ansi
> > to python...so its utf-8 as far asi can see
> 
> You won't get a straight answer because you won't tell us *precisely* 
> what is happening.
> 
> 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.
> 
> Until you do that, we cannot give you a straight answer.
> 
> You also need to COPY AND PASTE the EXACT line of code that gives the 
> error, plus enough code so that it works. For a file read error, that 
> probably means code that opens the file, and then tries to read from it.
> 
> Until you do that, we cannot give you a straight answer.
> 
> You need to tell us what version of Python you are using, and the 
> operating system.
> 
> You should read this:
> 
> http://sscce.org/
> 
> Even though it is written for Java programmers, it applies to Python to.
> 
> If you think that your file is UTF-8, why are you using CP-1252 to read 
> the file?
> 
> https://en.wikipedia.org/wiki/Windows-1252
> 
> https://en.wikipedia.org/wiki/UTF-8
> 
> 
> 
> I recommend you start with reading this if you haven't already:
> 
> https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-
> software-developer-absolutely-positively-must-know-about-unicode-and-
> character-sets-no-excuses/
> 
> Sorry for the huge URL, try this if your mail client breaks it:
> 
> https://tinyurl.com/h8yg9d7
> 
> 
> Until you read that, you will probably remain confused about text  
> encodings and Unicode and will probably not understand the straight 
> answer we give you.
> 
> Also read: https://nedbatchelder.com/text/unipain.html
> 
> 
> 
> -- 
> Steven D'Aprano
> "Ever since I learned about confirmation bias, I've been seeing
> it everywhere." -- Jon Ronson

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:

*********************

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

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


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 runs completey fine in python 2, so for me the issue is with python 3 and its changes relative to python 2

tommy



More information about the Python-list mailing list