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 56EB9429E26 for ; Fri, 22 Jul 2011 07:15:18 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.3 X-Spam-Level: X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5 tests=[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 k-xbM-nF5TJY for ; Fri, 22 Jul 2011 07:15:14 -0700 (PDT) Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by olra.theworths.org (Postfix) with ESMTP id 6B117431FD0 for ; Fri, 22 Jul 2011 07:15:14 -0700 (PDT) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QkGVT-0006fE-QN for notmuch@notmuchmail.org; Fri, 22 Jul 2011 16:15:11 +0200 Received: from HSI-KBW-095-208-113-104.hsi5.kabel-badenwuerttemberg.de ([95.208.113.104]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 22 Jul 2011 16:15:11 +0200 Received: from michael by HSI-KBW-095-208-113-104.hsi5.kabel-badenwuerttemberg.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 22 Jul 2011 16:15:11 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: notmuch@notmuchmail.org From: Michael Heinrich Subject: [Patch] tag.py: Bugfix to avoid decode() on a NoneType object Date: Fri, 22 Jul 2011 14:11:41 +0000 (UTC) Lines: 32 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: sea.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 95.208.113.104 (Mozilla/5.0 (X11; Linux x86_64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1) X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jul 2011 14:15:18 -0000 Dear all, with current head I get following error in my python scripts when I read the tags of a message: File "/home/heinrich/.local/lib/python2.6/site-packages/notmuch/tag.py", line 88, in next tag = Tags._get(self._tags).decode('utf-8') Here is a patch: diff --git a/bindings/python/notmuch/tag.py b/bindings/python/notmuch/tag.py index 65a9118..e9049fc 100644 --- a/bindings/python/notmuch/tag.py +++ b/bindings/python/notmuch/tag.py @@ -85,10 +85,12 @@ class Tags(object): raise NotmuchError(STATUS.NOT_INITIALIZED) # No need to call nmlib.notmuch_tags_valid(self._tags); # Tags._get safely returns None, if there is no more valid tag. - tag = Tags._get(self._tags).decode('utf-8') + tag = Tags._get(self._tags) if tag is None: self._tags = None raise StopIteration + else: + tag = tag.decode('utf-8') nmlib.notmuch_tags_move_to_next(self._tags) return tag Michael.