On Tue, 04 Jul 2006 19:00:23 +0200, Dennis Benzinger wrote: > Nomen Nescio wrote: >> I'm running gpg in python to verify a signature. I can see that it is >> working, because gpg is displaying the results. >> >> But I need a way to let the python script know this. According to the >> gpg manual there is a return code from gpg of 0 if the verify is good >> and 1 if it is bad. >> >> Can anyone tell me how I can get the python script to 'see' this return >> code? >> >> > How do you run GPG? I suggest using the subprocess module > <http://docs.python.org/lib/module-subprocess.html>. If you just need > something simple then you can use its call function > <http://docs.python.org/lib/node236.html>.
Thanks, I used the popen function which did some of what I want. Here is the code I used: from subprocess import * output = Popen(["gpg", "--output", "--verify", "sigtest"], stdout=PIPE).communicate()[0] That worked, sort of - it did the verification at least and I can see the return code. What is still not working is the display from gpg. It shows up on the monitor screen like this: gpg: Signature made Tue 04 Jul 2006 08:04:10 AM CET using DSA key ID 06B09BA4 gpg: Good signature from "Boz Scraggs <[EMAIL PROTECTED]>" I need to get that into a file so I can parse it. Any further suggestions? -- http://mail.python.org/mailman/listinfo/python-list