Check if keys dir exists. if not make it before saving to prevent exception.

This commit is contained in:
HeshamTB 2020-04-17 16:34:03 +03:00
parent 936a6eebb6
commit 654cb52ca4
Signed by: Hesham
GPG Key ID: 74876157D199B09E

2
rsa.py
View File

@ -134,6 +134,8 @@ def readKeyFile(keyName):
def saveKeyFile(key, fileName): def saveKeyFile(key, fileName):
if not os.path.isdir(keysFolder):
os.makedirs(keysFolder)
with open(keysFolder+fileName, "w") as keyFile: with open(keysFolder+fileName, "w") as keyFile:
keyFile.write("{0}\n{1}\n{2}\n".format(hex(key[0]), hex(key[1]), hex(key[2]))) keyFile.write("{0}\n{1}\n{2}\n".format(hex(key[0]), hex(key[1]), hex(key[2])))