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

bellcanadardp at gmail.com bellcanadardp at gmail.com
Sun Jun 10 16:04:28 EDT 2018


On Friday, 8 June 2018 18:26:28 UTC-4, Cameron Simpson  wrote:
> 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>

here is the full error once again
to summarize, my script works fine in python2 
i get this error trying to run it in python3
plz see below after the error, my settings for python 2 and python 3
for me it seems i need to change some settings to 'utf-8'..either just in python 3, since thats where i am having issues or change the settings to 'utf-8' both in python 2 and 3....i would appreciate feedback b4 i do some trial and error
thanks for the consideration
tommy

***********************************************
Traceback (most recent call last):

File "createIndex.py", line 132, in <module>
c.createindex()

File "creatIndex.py", line 102, in createIndex
pagedict=self.parseCollection()

File "createIndex.py", line 47, in parseCollection
for line in self.collFile:

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

***************************************************
python 3 settings
import sys
 import locale
locale.getpreferredencoding()
'cp1252'
 sys.stdout.encoding
'cp1252'
 sys.getdefaultencoding()
'utf-8'
sys.getfilesystemencoding()
'utf-8'
 sys.stdin.encoding
'cp1252'
 sys.stderr.encoding
'cp1252'

PYTHON 2 settings
import sys
 import locale
 locale.getpreferredencoding()
'cp1252'
 sys.stdout.encoding
'cp1252'
 sys.getdefaultencoding()
'ascii'
 sys.getfilesystemencoding()
'mbcs'
 sys.stdin.encoding
'cp1252'
 sys.stderr.encoding
'cp1252'
***************************************



More information about the Python-list mailing list