How to set the GnuPG home directory within the GnuPG Python binding?
问题 When trying to initialize the GnuPG binding in Python, I'm getting an error message TypeError: __init__() got an unexpected keyword argument 'gnupghome' This is the code I'm running: import gnupg gpg = gnupg.GPG(gnupghome='C:\Users\samss\AppData\Roaming\gnupg') input_data = gpg.gen_key_input(key_type="RSA", key_length=1024, passphrase='n0sm@sy0') key =gpg.gen_key(input_data) print key What am I doing wrong here? 回答1: You should refer to the gnupg documentation as it uses homedir at the place