I'm trying to decrypt some data from gpg files that I've downloaded. Downloading the files to a directory is no problem, but I'm having trouble actually decrypting them. Here's what I'm doing right now:
def extractGPGs(gpglist,path,gpgPath="\"C:\\Program Files\\GNU\\GnuPG\\gpg.exe\""):
os.chdir(path)
if not os.path.isdir("GPGFiles"):
os.mkdir("GPGFiles")
if not os.path.isdir("OtherFiles"):
os.mkdir("OtherFiles")
if gpglist == None:
print "No GPG files found"
return
try:
gpg = gnupg.GPG(gpgbinary=gpgPath)
except:
raise "Path to gpg.exe is bad"
print "Extracting GPG Files..."
for filename in gpglist:
print "Extracting %s..." % filename
stream = open(filename,"rb")
decrypted_data = gpg.decrypt_file(stream,output=".\\OtherFiles")
stream.close()
print "Finished Extracting GPG Files"
And here is the error that I'm getting:
Traceback (most recent call last):
File "C:\Documents and Settings\user\Desktop\downloadData.py", line 281, in <module>
main(vendor,category)
File "C:\Documents and Settings\user\Desktop\downloadData.py", line 273, in main
extractAndParse.main(info['LocalFolder'])
File "C:\Documents and Settings\user\Desktop\extractAndParse.py", line 147, in main
extractGPGs(getGPGs(getAllArchives(path)),path)
File "C:\Documents and Settings\user\Desktop\extractAndParse.py", line 133, in extractGPGs
decrypted_data = gpg.decrypt_file(stream,output=".\\OtherFiles")
File "C:\Python25\Lib\site-packages\gnupg.py", line 574, in decrypt_file
os.remove(output) # to avoid overwrite confirmation message
WindowsError: [Error 5] Access is denied: '.\\OtherFiles'
Why am I getting this error, and, more importantly, how can I decrypt the gpg's?