From 9b48fb56e499863a674a5b005b966a254aac220a Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 15 Dec 2014 21:46:40 +0100 Subject: [PATCH] Re: Python bindings and Xapian exceptions --- f2/ec057f9a2b48899ddaa5c024040bf7b88846c6 | 103 ++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 f2/ec057f9a2b48899ddaa5c024040bf7b88846c6 diff --git a/f2/ec057f9a2b48899ddaa5c024040bf7b88846c6 b/f2/ec057f9a2b48899ddaa5c024040bf7b88846c6 new file mode 100644 index 000000000..6db105f1c --- /dev/null +++ b/f2/ec057f9a2b48899ddaa5c024040bf7b88846c6 @@ -0,0 +1,103 @@ +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 657F7431FC4 + for ; Mon, 15 Dec 2014 12:46:44 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.799 +X-Spam-Level: +X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 ZkRZArj35Ct9 for ; + Mon, 15 Dec 2014 12:46:41 -0800 (PST) +Received: from mail-qa0-f48.google.com (mail-qa0-f48.google.com + [209.85.216.48]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 1EBA6431FAF + for ; Mon, 15 Dec 2014 12:46:41 -0800 (PST) +Received: by mail-qa0-f48.google.com with SMTP id v10so8648580qac.21 + for ; Mon, 15 Dec 2014 12:46:40 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=mime-version:in-reply-to:references:date:message-id:subject:from:to + :cc:content-type; + bh=A/zw5n3vMoZnapi8hlyv4MGR+qU2RaT6ivCEzu3LO30=; + b=jXCH5Qgcjy+Gp+f5hvJ5Ar+6rwF8bCgihjAMWgU1TtGvyA7c5hs6GY0UlF59PRR785 + otvLajJ6AmrmPinTihHXH7isws0jiJ47TCSaLWDQyIX0gKEjKq1zgqPzIG5v3yAQd28R + b44A3GI67AhQBq4tOhBg0w41O11PwaTs0qUKapwnQG4MOyZqc/YFPKsBL9Kx4JBF5dVs + CH3o9ROfS32/DeeStK3qUwbtye6xqIdiIIhteCAqKz+kODhy3tit8GkyoJy3LPQ//aDD + C4iw7eoC//VCV020M41xDdTdnXlT2FWV70dmXSATiCcxvMEalbl08i0oxsejKKx7ctmq + Y/OQ== +MIME-Version: 1.0 +X-Received: by 10.140.85.104 with SMTP id m95mr55358337qgd.93.1418676400496; + Mon, 15 Dec 2014 12:46:40 -0800 (PST) +Received: by 10.96.77.105 with HTTP; Mon, 15 Dec 2014 12:46:40 -0800 (PST) +In-Reply-To: <87iohc7iiz.fsf@maritornes.cs.unb.ca> +References: <87k4q7s43v.fsf@ut.hh.sledj.net> <878w6gis5g.fsf@SSpaeth.de> + <871v70ril7.fsf@yoom.home.cworth.org> <871v70z0y5.fsf@SSpaeth.de> + + <87iohc7iiz.fsf@maritornes.cs.unb.ca> +Date: Mon, 15 Dec 2014 21:46:40 +0100 +Message-ID: + +Subject: Re: Python bindings and Xapian exceptions +From: Matt +To: David Bremner +Content-Type: text/plain; charset=UTF-8 +X-Mailman-Approved-At: Tue, 16 Dec 2014 00:13:44 -0800 +Cc: notmuch@notmuchmail.org +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: Mon, 15 Dec 2014 20:46:44 -0000 + +2014-12-15 21:41 GMT+01:00 David Bremner : +> Matt writes: +> +>>> > But for exceptions in general, yes the notmuch library does need to be +>>> > fixed to allow the caller of functions to distinguish between things +>>> > like "no matches found" and "an exception occurred, so it's unknown if +>>> > any messages match the search". That's a general class of library +>>> > interface bugs that all need to be fixed. +>> +>> I 've also hit this *API bug* and was wondering if a fix had been done since +>> then (I use notmuch 0.17) ? I found nothing on http://notmuchmail.org/news/ +> +> Can you be more specific? I'd say in general no thorough overhaul of +> error handling has happened, but if you can tell us what particular +> libnotmuch function (or the equivalient python binding) you are having +> trouble with, we may be able to give a more informative answer. +> + +For instance when using the python bindings: +In constructor I do +self.db = notmuch.Database(self.db_path) +and there I have a method called periodically that returns: +returns notmuch.Query(self.db, "tag:unread and tag:inbox").count_messages() + +When it fails the previous method returns 0 and displays on stdout/stderr; +"A Xapian exception occurred: The revision being read has been +discarded - you should call Xapian::Database::reopen() and retry the +operation +Query string was: tag:unread and tag:inbox" + +The way for me to detect an error is to redirect stdout and check if +the method outputted to stdout, which is not practical. I wish it +would either return "-1", throw an exception or return 2 numbers like +"errorcode, returned value". I personnally don't care if it's done at +the library level or in the python bindings. + +Regards -- 2.26.2