unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Sebastian Fischmeister <sfischme@uwaterloo.ca>
To: notmuch <notmuch@notmuchmail.org>
Subject: UnicodeDecodeError with python API
Date: Sun, 29 Mar 2015 09:08:28 -0400	[thread overview]
Message-ID: <874mp4q7e7.fsf@uwaterloo.ca> (raw)

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

             reply	other threads:[~2015-03-29 13:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-29 13:08 Sebastian Fischmeister [this message]
2015-03-29 16:36 ` UnicodeDecodeError with python API W. Trevor King
2015-03-29 23:10   ` Sebastian Fischmeister
2015-03-30  5:26     ` W. Trevor King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874mp4q7e7.fsf@uwaterloo.ca \
    --to=sfischme@uwaterloo.ca \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).