catching output from gpg --verify

Brad Tilley rtilley at vt.edu
Tue Jul 19 19:21:00 CEST 2005


Hello Gnupg users,

I am writing a script to automate the downloading and building of Linux
kernels. As a part of the script, I use gpg to check and make sure that
the kernel key is installed:

    check = os.popen('gpg --list-keys')
    data = check.read()
    check.close()

This works well. I can read the data from gpg --list-keys and check it
and then proceed. If the key is not installed, I download and install
it, if it is installed, I move on.

However, the next case in which I need to use gpg fails because I cannot
capture the output of gpg --verify:

    cmd = os.popen('gpg --verify kernel_name_sig, kernel_name)    
    data = cmd.read()
    cmd.close()

I've tried re-directing the output to a file (doesn't work) form the
command line and from my script. Any tips on how to capture this output
would be greatly appreciated.






More information about the Gnupg-users mailing list