G
George
Hi,
Does anyone have any experience with GnuPGInterface? I'm having a
problem with decrypting files through a cron job. The below job works
great when I run it manually from the command line, but it blows up
whenever I try to run it through cron, and I can't really figure out
why. I've been trying to learn python, and I'm at the point where I can
get things working in small scripts (you know, just enough to be
dangerous). If anybody could shed some light as to what I might be
doing wrong, I would really appreciate it. TIA...
#!/usr/local/bin/python
import os, glob, time, GnuPGInterface
gnupg = GnuPGInterface.GnuPG()
gnupg.options.extra_args.append('--no-secmem-warning')
gnupg.passphrase = ######
# get list of files in /home/ns1
# that match regex pattern
for pgpname in glob.glob("/home/ns1/[ABDP]*.pgp"):
txtname = pgpname.replace('.pgp','.txt')
inputfile = file(pgpname,'r')
outputfile = file(txtname,'w')
process = gnupg.run(['--decrypt'],
attach_fhs={'stdin':inputfile,'stdout'
utputfile})
process.wait() # cleanup
inputfile.close()
outputfile.close()
os.remove(pgpname)
Does anyone have any experience with GnuPGInterface? I'm having a
problem with decrypting files through a cron job. The below job works
great when I run it manually from the command line, but it blows up
whenever I try to run it through cron, and I can't really figure out
why. I've been trying to learn python, and I'm at the point where I can
get things working in small scripts (you know, just enough to be
dangerous). If anybody could shed some light as to what I might be
doing wrong, I would really appreciate it. TIA...
#!/usr/local/bin/python
import os, glob, time, GnuPGInterface
gnupg = GnuPGInterface.GnuPG()
gnupg.options.extra_args.append('--no-secmem-warning')
gnupg.passphrase = ######
# get list of files in /home/ns1
# that match regex pattern
for pgpname in glob.glob("/home/ns1/[ABDP]*.pgp"):
txtname = pgpname.replace('.pgp','.txt')
inputfile = file(pgpname,'r')
outputfile = file(txtname,'w')
process = gnupg.run(['--decrypt'],
attach_fhs={'stdin':inputfile,'stdout'
process.wait() # cleanup
inputfile.close()
outputfile.close()
os.remove(pgpname)