From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id sLDYEc/mt18ZLQAA0tVLHw (envelope-from ) for ; Fri, 20 Nov 2020 15:54:55 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id KHeeDc/mt18iZgAA1q6Kng (envelope-from ) for ; Fri, 20 Nov 2020 15:54:55 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 6159F94021E for ; Fri, 20 Nov 2020 15:54:54 +0000 (UTC) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 7B92D28C64; Fri, 20 Nov 2020 10:54:47 -0500 (EST) Received: from knopi.disroot.org (knopi.disroot.org [178.21.23.139]) by mail.notmuchmail.org (Postfix) with ESMTPS id 170D9270CC for ; Fri, 20 Nov 2020 10:54:45 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id A3B0C53484 for ; Fri, 20 Nov 2020 16:54:43 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at disroot.org Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Pwhks5BWeGK5 for ; Fri, 20 Nov 2020 16:54:41 +0100 (CET) From: "Jorge P. de Morais Neto" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1605887681; bh=F4beuf989tjjAUCC3oQFpb30hmmH4FswWjwIIxDiCK0=; h=From:To:Subject:Date; b=RxLpnxyb7i4sRc9IVLPEIhoYGPb7H6PMjEQpOIpfqgRcfo8YZn3TNVQXZfJ7DMTyS voB4h6F3tKTSA90cSU7cAf96pbEBZ14LAembgpBuu+mJW+UFDx2cSphbxQ+OnRkFo3 nUbrlcHRcp6XtM6WWCRivKV7Uu2cjPSLBesCTc1FUw2aiCER9QxKij5kFu60z8IT7u RhyWJ8VJWOOHIYJ4C5+xzShDVNIEHP9GFhmjVQ657zA27zzufJuBuBczO7msoHU4d1 pQDGxgTwB/8sehsem8ATHU7boMOm7wWifKZcH6AqeEQRZ13VdDzupo9eXWYeOeF9PE oud/tbv34cecA== To: notmuch@notmuchmail.org Subject: New Python bindings (notmuch2 module) fail to exclude tags Mail-Followup-To: notmuch@notmuchmail.org Date: Fri, 20 Nov 2020 12:54:31 -0300 Message-ID: <87r1oohvm0.fsf@disroot.org> Mime-Version: 1.0 Message-ID-Hash: 7HP3TWECHYHPJTGMEHNEDFQQPQW57T43 X-Message-ID-Hash: 7HP3TWECHYHPJTGMEHNEDFQQPQW57T43 X-MailFrom: jorge+list@disroot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Scanner: ns3122888.ip-94-23-21.eu X-Spam-Score: 6.00 Authentication-Results: aspmx1.migadu.com; dkim=fail (body hash did not verify) header.d=disroot.org header.s=mail header.b=RxLpnxyb; dmarc=fail reason="SPF not aligned (relaxed)" header.from=disroot.org (policy=quarantine); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Spam: Yes X-TUID: J9Ub/LwFDW0b Hi. I am trying to migrate my Python3 script to the new Python bindings (notmuch2 module). However, I cannot obtain a count of messages matching a query excluding messages that have an exclude tag. From the command line: $ notmuch count 'is:.bf_spam' 0 The CLI command correctly counts zero messages having '.bf_spam' tag, because all such messages also have the excluded 'spam' tag. But from Python: $ python3 Python 3.7.3 (default, Jul 25 2020, 13:03:44) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import notmuch2 >>> nm_db=notmuch2.Database() >>> nm_db.count_messages('is:.bf_spam', exclude_tags=('spam',)) 379 >>> nm_db.count_messages('is:.bf_spam', exclude_tags=('spam',), omit_excluded=nm_db.EXCLUDE.FALSE) 379 >>> nm_db.count_messages('is:.bf_spam', exclude_tags=('spam',), omit_excluded=nm_db.EXCLUDE.TRUE) 379 >>> nm_db.count_messages('is:.bf_spam', exclude_tags=('spam',), omit_excluded=nm_db.EXCLUDE.ALL) 379 >>> nm_db.count_messages('is:.bf_spam', exclude_tags=('spam',), omit_excluded=nm_db.EXCLUDE.FLAG) 379 Am I doing something wrong? Regards -- - - If an email of mine arrives at your spam box, please notify me. - Please adopt free/libre formats like PDF, ODF, Org, LaTeX, Opus, WebM and 7z. - Free/libre software for Replicant, LineageOS and Android: https://f-droid.org - [[https://www.gnu.org/philosophy/free-sw.html][What is free software?]]