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

bellcanadardp at gmail.com bellcanadardp at gmail.com
Wed Jun 13 09:28:29 EDT 2018


On Wednesday, 13 June 2018 07:14:06 UTC-4, INADA Naoki  wrote:
> ​> 1st is this script is from a library module online open source
> 
> If it's open source, why didn't you show the link to the soruce?
> I assume your code is this:
> 
> https://github.com/siddharth2010/String-Search/blob/6770c7a1e811a5d812e7f9f7c5c83a12e5b28877/createIndex.py
> 
> And self.collFile is opened here:
> 
> https://github.com/siddharth2010/String-Search/blob/6770c7a1e811a5d812e7f9f7c5c83a12e5b28877/createIndex.py#L91
> 
> You need to add `encoding='utf-8'` argument.

thank you INADA
 here is the line of code solution
**************
self.collFile=open(self.collectionFile,'r',encoding='utf-8')
******************
it was tricky only because the modification had to be done not at the actual error line but further down in the file where INADA correctly pointed out where the collFile is opened

thank you to all who posted, i truly appreciate all posts

tommy



More information about the Python-list mailing list