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.

LookupError: unknown encoding: utf-8 euao6y69zh2w

See original GitHub issue

Email: imbox_lookuperror_unknown_encoding.eml.txt

Traceback (most recent call last):
  File "/home/ubuntu/.local/lib/python3.6/site-packages/imbox/parser.py", line 128, in decode_content
    return content.decode(charset, 'ignore')
LookupError: unknown encoding: utf-8  euao6y69zh2w

During handling of the above exception, another exception occurred:

    for uid, msg in unread_junk:
  File "/home/ubuntu/.local/lib/python3.6/site-packages/imbox/messages.py", line 39, in _fetch_email_list
    yield uid, self._fetch_email(uid)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/imbox/messages.py", line 28, in _fetch_email
    parser_policy=self.parser_policy)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/imbox/parser.py", line 141, in fetch_email_by_uid
    email_object = parse_email(raw_email, policy=parser_policy)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/imbox/parser.py", line 187, in parse_email
    content = decode_content(part)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/imbox/parser.py", line 130, in decode_content
    return content.decode(charset.replace("-", ""), 'ignore')
LookupError: unknown encoding: utf8  euao6y69zh2w

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
py-radiczcommented, May 18, 2020

thats great idea to practice the PR since I have never done that. Will do.

1reaction
py-radiczcommented, May 15, 2020

or maybe this also fixes broader range of cases

def decode_content(message):
   content = message.get_payload(decode=True)
   charset = message.get_content_charset('utf-8')
   try:
       return content.decode(charset, 'ignore')
   except LookupError:
       import chardet
       encoding = chardet.detect(content).get('encoding')
       if encoding:
           return content.decode(encoding, 'ignore')
        return content
   except AttributeError:
       return content
Read more comments on GitHub >

github_iconTop Results From Across the Web

("unknown encoding: 'b'utf-8-sig''",) - Stack Overflow
I am getting a LookupError when I specify my ...
Read more >
LookupError: unknown encoding in Python | bobbyhadz
The Python LookupError: unknown encoding occurs when we specify an encoding that is not supported. To solve the error, use the `utf-8` ...
Read more >
Project encoding is ignored : PY-17100 - YouTrack - JetBrains
... LookupError: unknown encoding: windows-31j Process finished with exit code 3. Kotlin detected. Project encoding is UTF-8, but this setting is ignored ...
Read more >
Unknown encoding : ibm_1252. No answer from Python on ...
The funny part was that in batch mode there was no problem. Now the solution. What was the problem ? LookUpError, traceback :...
Read more >
1958161 – python-concurrentloghandler fails to build with ...
open(self.baseFilename, mode, self.encoding) File "/usr/lib64/python3.10/codecs.py", line 910, in open info = lookup(encoding) LookupError: unknown encoding: ...
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