From 47bd9e9b757d1221fb4d8d2f34d5d04ef1770b53 Mon Sep 17 00:00:00 2001 From: Sebastian Fischmeister Date: Mon, 30 Mar 2015 09:08:28 +2000 Subject: [PATCH] UnicodeDecodeError with python API --- 40/b9ee226bb2f7ff70b87b4ae6988bfd325fece8 | 97 +++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 40/b9ee226bb2f7ff70b87b4ae6988bfd325fece8 diff --git a/40/b9ee226bb2f7ff70b87b4ae6988bfd325fece8 b/40/b9ee226bb2f7ff70b87b4ae6988bfd325fece8 new file mode 100644 index 000000000..cd410c7c4 --- /dev/null +++ b/40/b9ee226bb2f7ff70b87b4ae6988bfd325fece8 @@ -0,0 +1,97 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id CFC14431FBF + for ; Sun, 29 Mar 2015 06:08:34 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.138 +X-Spam-Level: +X-Spam-Status: No, score=0.138 tagged_above=-999 required=5 + tests=[DNS_FROM_AHBL_RHSBL=2.438, RCVD_IN_DNSWL_MED=-2.3] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id GnYdSN9mr357 for ; + Sun, 29 Mar 2015 06:08:31 -0700 (PDT) +Received: from mailchk-m01.uwaterloo.ca (mailservices.uwaterloo.ca + [129.97.128.141]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 94F02431FAE + for ; Sun, 29 Mar 2015 06:08:31 -0700 (PDT) +Received: from connect.uwaterloo.ca (connhub1.connect.uwaterloo.ca + [129.97.149.113]) + by mailchk-m01.uwaterloo.ca (8.14.4/8.14.4) with ESMTP id + t2TD8Smj001215 + (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=OK) + for ; Sun, 29 Mar 2015 09:08:29 -0400 +Received: from CONNHUB4.connect.uwaterloo.ca (129.97.149.122) by + connhub1.connect.uwaterloo.ca (129.97.149.113) with Microsoft SMTP + Server (TLS) id 14.3.210.2; Sun, 29 Mar 2015 09:08:28 -0400 +Received: from uwaterloo.ca (172.16.37.102) by connhub4.connect.uwaterloo.ca + (129.97.149.122) with Microsoft SMTP Server (TLS) id 14.3.210.2; + Sun, 29 Mar 2015 09:08:28 -0400 +From: Sebastian Fischmeister +To: notmuch +Subject: UnicodeDecodeError with python API +X-Homepage: http://esg.uwaterloo.ca +Date: Sun, 29 Mar 2015 09:08:28 -0400 +Message-ID: <874mp4q7e7.fsf@uwaterloo.ca> +MIME-Version: 1.0 +Content-Type: text/plain +X-UUID: 49d3b0a5-5c20-4aea-8eb9-f5939f33af50 +X-Miltered: at mailchk-m01 with ID 5517F94C.000 by Joe's j-chkmail + (http://j-chkmail.ensmp.fr)! +X-Virus-Scanned: clamav-milter 0.98.6 at mailchk-m01 +X-Virus-Status: Clean +X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 + (mailchk-m01.uwaterloo.ca [129.97.128.141]); + Sun, 29 Mar 2015 09:08:29 -0400 (EDT) +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +Reply-To: sfischme@uwaterloo.ca +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sun, 29 Mar 2015 13:08:35 -0000 + +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 + 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 -- 2.26.2