[PATCH] python: add bindings for notmuch_message_get_propert(y/ies)

meskio meskio at sindominio.net
Tue May 1 08:24:30 PDT 2018


Quoting David Bremner (2018-05-01 15:06:38)
> running the test below, I get
> 
> Traceback (most recent call last):
>   File "<stdin>", line 4, in <module>
>   File "/home/bremner/software/upstream/notmuch/bindings/python/notmuch/message.py", line 480, in get_property
>     value = c_char_p("")
> TypeError: bytes or integer address expected instead of str instance

Ups, I was using python2 to test it. I see it doesn't work with python three.  
I'll send an update.

> diff --git a/test/T610-message-property.sh b/test/T610-message-property.sh
> index 74b3f5a1..f7220565 100755
> --- a/test/T610-message-property.sh
> +++ b/test/T610-message-property.sh
> @@ -89,6 +89,18 @@ testkey2 = NULL
>  EOF
>  test_expect_equal_file EXPECTED OUTPUT
>  
> +test_begin_subtest "msg.get_property (python)"
> +test_python <<'EOF'
> +import notmuch
> +db = notmuch.Database(mode=notmuch.Database.MODE.READ_WRITE)
> +msg = db.find_message("4EFC743A.3060609 at april.org")
> +print("testkey1[1] = %s\n".format(msg.get_property("testkey1")))

I think this should be (notice the {0} instead of %s):
print("testkey1[1] = {0}".format(msg.get_property("testkey1")))


-- 
meskio | http://meskio.net/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 My contact info: http://meskio.net/crypto.txt
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Nos vamos a Croatan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: signature
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20180501/a6e0836b/attachment.sig>


More information about the notmuch mailing list