The following is the code that I have been trying.
import os
import gnupg
import pdb
pdb.set_trace()
gpg = gnupg.GPG(gnupghome='new')
input_data = gpg.gen_key_input(
key_type="RSA",key_length=1024,
passphrase='mounika')
key = gpg.gen_key(input_data)
with open(local.txt,'rb')as f:
status=gpg.encrypt_file(f)
And the following is the error message being generated.
C:\Python27\python.exe C:/SAAS/encrypt.py
Traceback (most recent call last):
File "C:/SAAS/encrypt.py", line 4, in <module>
gpg = gnupg.GPG(gnupghome='new')
File "C:\Python27\lib\site-packages\gnupg.py", line 755, in __init__
raise OSError(msg)
OSError: Unable to run gpg - it may not be available.
Process finished with exit code 1
I am fairly new to GnuPG and after doing a bit of research I tried replacing gnupghome with homedir. But this is raising another error that homedir is an unexpected keyword.Can soneone pls help me with this issue. Any help would be appreciated.
You need to install the gpg program and make sure it is in your PATH. Or provide the full path to the gpg binary in your constructor, like
gpg = gnupg.GPG(gnupghome='new', gpgbinary='C:\\path\\to\\GnuPG\\pub\\gpg.exe')
Check also the Deployment Requirements for the python-gnupg package for more info.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With