0

I have an issue using the gnupg module in python in Ubuntu 14.

My keychain is set up correctly. I can use gpg on the command line to decrypt files with having to enter my passphrase.

I have also checked that my gpg-agent is running.

However, in my python script, I constantly get an error to the effect that no passphrase is available for my private key, which it needs to decrypt the file.

The error I am getting is:

Error opening terminal: unknown

I have also confirmed that I am using GPG 2+

Code is:

import gnupg
import os

def set_auth(k):

    h = os.path.expanduser("~")

    gpg = gnupg.GPG(homedir='~/.gnupg',use_agent=True)

    with open(h + "/.secure/" + k + ".gpg", "rb") as f:
        status = gpg.decrypt_file(f, output=h + "/.secure/key.tmp")
0

This turned out to be a bug in the version of python that this issue of Ubuntu was installing.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.