aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python/examples/howto/export-secret-keys.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xlang/python/examples/howto/export-secret-keys.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/lang/python/examples/howto/export-secret-keys.py b/lang/python/examples/howto/export-secret-keys.py
index f0a791ef..7203ded9 100755
--- a/lang/python/examples/howto/export-secret-keys.py
+++ b/lang/python/examples/howto/export-secret-keys.py
@@ -84,7 +84,13 @@ else:
if os.path.exists(os.environ["GNUPGHOME"]) is True:
hd = os.environ["GNUPGHOME"]
else:
- hd = subprocess.getoutput(gpgconfcmd)
+ try:
+ hd = subprocess.getoutput(gpgconfcmd)
+ except:
+ process = subprocess.Popen(gpgconfcmd.split(),
+ stdout=subprocess.PIPE)
+ procom = process.communicate()
+ hd = procom[0].decode().strip()
gpgfile = "{0}/{1}.gpg".format(hd, keyfile)
ascfile = "{0}/{1}.asc".format(hd, keyfile)