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")