Questions using GPGME

Justus Winter justus at
Thu Jul 6 16:01:47 CEST 2017

Andreas Heinlein <aheinlein at> writes:

> Am 06.07.2017 um 14:01 schrieb Justus Winter:
>>> 2.) Is there a way to safely distinguish "User clicked cancel when asked
>>> for the passphrase" from other errors? I think an application should
>>> abort silently in this case, but I'm getting another GPGMEError without
>>> any clue to the reason.
>> Maybe.  GPGMEError is a very general error, this is a bit of pyme
>> legacy.  You can inspect the error code using .getcode().  For a quick
>> check, try to str() the error.
> Thank you for the quick answer. I gave it a try with 3 tests, one
> decrypt with cancel'ing the pinentry, one with missing private key and
> one with a truncated input file. All three gave
> print str(e): Invocation of gpgme_op_decrypt_verify: GPGME: Decryption
> failed
> print e.getcode(): 152
> So this doesn't help.

Well, then it is not python-gpg's fault, but the underlying library or
components do not differentiate that.

> But good to know someone is working on this

I'm not.  If you feel that this is important, please file a bug.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: not available
URL: </pipermail/attachments/20170706/99b4314c/attachment-0001.sig>

More information about the Gnupg-users mailing list