question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

failed: 'charmap' codec can't decode byte ..

See original GitHub issue

Hey guys,

I tried to scan for e-mails and got the following error:

2022-06-09 04:21:47,904 [INFO] sfwebui : Waiting for the scan to initialize...
Process Process-3:
Traceback (most recent call last):
  File "C:\Users\d.tran\Anaconda3\envs\spiderfoot\lib\multiprocessing\process.py", line 297, in _bootstrap
    self.run()
  File "C:\Users\d.tran\Anaconda3\envs\spiderfoot\lib\multiprocessing\process.py", line 99, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\d.tran\Downloads\spiderfoot\sfscan.py", line 30, in startSpiderFootScanner
    return SpiderFootScanner(*args, **kwargs)
  File "C:\Users\d.tran\Downloads\spiderfoot\sfscan.py", line 202, in __init__
    tld_data = self.__sf.cacheGet("internet_tlds", self.__config['_internettlds_cache'])
  File "C:\Users\d.tran\Downloads\spiderfoot\sflib.py", line 303, in cacheGet
    return fp.read()
  File "C:\Users\d.tran\Anaconda3\envs\spiderfoot\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 10466: character maps to <undefined>

After a littler reasearch I found out that, this error is caused by the missing encoding during opening the cache file in sflib.py - line 302. Dunno whether this is the correct way to solve it, but I wanna share it for all other people which having problems.

Note: Forgive my, maybe, not correct way to inform you about this. It’s the first I’am doing this.

Cheers, Daniel ✌️

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bcolescommented, Jun 9, 2022

Yeah there’s issues with caching. I started working on a patch for this but got sidetracked.

0reactions
smicallefcommented, Sep 22, 2022

This has now been fixed (applied the PR from @guylando - thanks again).

Read more comments on GitHub >

github_iconTop Results From Across the Web

'charmap' codec can't decode byte X in position Y: character ...
I get the OP error even though the encoding is already specified correctly as UTF-8 (as shown above) in open(). Any ideas? –...
Read more >
'charmap' codec can't decode byte 0x81 in position X ... - GitHub
OS: Windows Pytext Version: Tried with 1.10.0 and 1.11.1, error stack on 1.11.1 I am having this error when trying to use the...
Read more >
'charmap' codec can't decode byte 0x9d – Python File Read
File reading error in python with the following message UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 12345 ...
Read more >
'charmap' codec can't decode byte 0x81 in position 34: character
You should set the encoding when you read the file (fileinput). Windows must thing it is something other than utf-8. Reply.
Read more >
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d ...
In the chapter 10_NLP, executing the below code gives an error - txts = L(o.open().read() for o in files[:2000]) UnicodeDecodeError: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found