Python bindings: examples
* lang/python/examples/howto/export-secret-keys.py and groups.py: Updated the backwards compatibility adjustments to account for unicode differences between python 2 and 3.
This commit is contained in:
parent
864ef9b40f
commit
4e8a92ed14
@ -90,6 +90,9 @@ else:
|
|||||||
process = subprocess.Popen(gpgconfcmd.split(),
|
process = subprocess.Popen(gpgconfcmd.split(),
|
||||||
stdout=subprocess.PIPE)
|
stdout=subprocess.PIPE)
|
||||||
procom = process.communicate()
|
procom = process.communicate()
|
||||||
|
if sys.version_info[0] == 2:
|
||||||
|
hd = procom[0].strip()
|
||||||
|
else:
|
||||||
hd = procom[0].decode().strip()
|
hd = procom[0].decode().strip()
|
||||||
gpgfile = "{0}/{1}.gpg".format(hd, keyfile)
|
gpgfile = "{0}/{1}.gpg".format(hd, keyfile)
|
||||||
ascfile = "{0}/{1}.asc".format(hd, keyfile)
|
ascfile = "{0}/{1}.asc".format(hd, keyfile)
|
||||||
|
@ -42,6 +42,9 @@ try:
|
|||||||
except:
|
except:
|
||||||
process = subprocess.Popen(gpgconfcmd.split(), stdout=subprocess.PIPE)
|
process = subprocess.Popen(gpgconfcmd.split(), stdout=subprocess.PIPE)
|
||||||
procom = process.communicate()
|
procom = process.communicate()
|
||||||
|
if sys.version_info[0] == 2:
|
||||||
|
lines = procom[0].splitlines()
|
||||||
|
else:
|
||||||
lines = procom[0].decode().splitlines()
|
lines = procom[0].decode().splitlines()
|
||||||
|
|
||||||
for i in range(len(lines)):
|
for i in range(len(lines)):
|
||||||
|
Loading…
Reference in New Issue
Block a user