From 654cb52ca46ee83409e3ee441ba12eae5bce7057 Mon Sep 17 00:00:00 2001 From: HeshamTB Date: Fri, 17 Apr 2020 16:34:03 +0300 Subject: [PATCH] Check if keys dir exists. if not make it before saving to prevent exception. --- rsa.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rsa.py b/rsa.py index b9e6a8d..a78455b 100755 --- a/rsa.py +++ b/rsa.py @@ -134,6 +134,8 @@ def readKeyFile(keyName): def saveKeyFile(key, fileName): + if not os.path.isdir(keysFolder): + os.makedirs(keysFolder) 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])))