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 4F02D4196F4 for ; Tue, 15 Jun 2010 09:35:05 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.89 X-Spam-Level: X-Spam-Status: No, score=-1.89 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, T_MIME_NO_TEXT=0.01] autolearn=ham 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 R4MOUIDCaIbJ for ; Tue, 15 Jun 2010 09:34:54 -0700 (PDT) Received: from mail-wy0-f181.google.com (mail-wy0-f181.google.com [74.125.82.181]) by olra.theworths.org (Postfix) with ESMTP id B0F85431FC1 for ; Tue, 15 Jun 2010 09:34:54 -0700 (PDT) Received: by wyb35 with SMTP id 35so5406490wyb.26 for ; Tue, 15 Jun 2010 09:34:53 -0700 (PDT) Received: by 10.227.145.77 with SMTP id c13mr7436029wbv.140.1276619692731; Tue, 15 Jun 2010 09:34:52 -0700 (PDT) Received: from ut.hh.sledj.net ([83.217.165.81]) by mx.google.com with ESMTPS id u36sm47097477wbv.18.2010.06.15.09.34.50 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 15 Jun 2010 09:34:51 -0700 (PDT) Received: by ut.hh.sledj.net (Postfix, from userid 1000) id 04EF1594018; Tue, 15 Jun 2010 10:17:28 +0100 (BST) To: Sebastian Spaeth , notmuch Subject: Re: Python bindings and Xapian exceptions In-Reply-To: <878w6gis5g.fsf@SSpaeth.de> References: <87k4q7s43v.fsf@ut.hh.sledj.net> <878w6gis5g.fsf@SSpaeth.de> User-Agent: Notmuch/0.3.1-53-gb7aeaa1 (http://notmuchmail.org) Emacs/23.1.1 (x86_64-pc-linux-gnu) From: David Edmondson Date: Tue, 15 Jun 2010 10:17:25 +0100 Message-ID: <874oh4ejtm.fsf@ut.hh.sledj.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" 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: Tue, 15 Jun 2010 16:35:05 -0000 --=-=-= Content-Transfer-Encoding: quoted-printable On Tue, 15 Jun 2010 11:03:55 +0200, "Sebastian Spaeth" wrote: > > A Xapian exception occurred finding message: The revision being read > > has been discarded - you should call Xapian::Database::reopen() and > > retry the operation. > > It makes the Python bindings almost useless to me. >=20 > Not sure, if the python bindings should simply drop and reopen a > database connection in that case? But I am not sure if libnotmuch.so > still simply exits on such an error case. >=20 > The proper fix, and a reason why I am not immediately hacking around in > the python bindings is that notmuch the library would actually return a > proper error value rather than print to stderr and quit. >=20 > Happy to receive suggestions on how to handle this best from the python > side of things. Unfortunately I'm an ignorant about the best solution. Having the Python layer hide the fact that the database was re-opened seems as though it might be dangerous (in case I mix state from before and after the re-opening), but I can't give a concrete example of something that would fail. Given that exception based programming is common in Python, simple raising the exception and allowing the application to handle it appears to make sense. dme. =2D-=20 David Edmondson, http://dme.org --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEUEARECAAYFAkwXRSUACgkQaezQq/BJZRZQXQCfbFwSpimczLRvdFSgKT74cDKC DbAAmJ+ju+lNNTaWQvUULNymGKGgjMA= =vKYv -----END PGP SIGNATURE----- --=-=-=--