UnicodeDecodeError with python API

Subject: UnicodeDecodeError with python API

Date: Sun, 29 Mar 2015 09:08:28 -0400

To: notmuch

Cc:

From: Sebastian Fischmeister


Hi,

I'm trying to use the python API for notmuch, and get the following
error:

---

Traceback (most recent call last):
  File "./test.py", line 66, in <module>
    print(type(y.get_part(1)))
  File "/usr/lib/python3.4/site-packages/notmuch/message.py", line 602, in get_part
    parts = self.get_message_parts()
  File "/usr/lib/python3.4/site-packages/notmuch/message.py", line 591, in get_message_parts
    email_msg = email.message_from_file(fp)
  File "/usr/lib/python3.4/email/__init__.py", line 56, in message_from_file
    return Parser(*args, **kws).parse(fp)
  File "/usr/lib/python3.4/email/parser.py", line 54, in parse
    data = fp.read(8192)
  File "/usr/lib/python3.4/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3447: ordinal not in range(128)

---

The code works for most messages though. How can I get around this
problem? Is it a problem in my code or the binding?

I'm using notmuch 0.19 with python 3.4.3.

Thanks,
  Sebastian

Thread: