I have a python code that call a gpg command with os.system() to decrypt some files as part of a larger file management pipeline.  However, on my MacOS 10.11.6, I have a version of gpg2 that I use to decrypt files.
So Iād like to add in the script some check of whether gpg or gpg2 are present on the machine.
I tried to test a call for gpg and catch a possible OSError with:
try:
    os.system("gpg --version")
except OSError:
    print("gpg not found")
But this doesn't work even if gpg is not present and the output of the os.system() call is:
sh: gpg: command not found
32512
Any idea of how I can do this?
(PS: I have no clue what the 32512 is...)
 
     
     
    