From 5e2cef2cdea3dfcf7f3d0c68d9ce6b6943c62186 Mon Sep 17 00:00:00 2001 From: rasmusvt Date: Tue, 5 Jul 2022 16:37:31 +0200 Subject: [PATCH] Let save_options create folder if it doesn't exist --- nafuma/auxillary.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nafuma/auxillary.py b/nafuma/auxillary.py index bf06f8e..45633c5 100644 --- a/nafuma/auxillary.py +++ b/nafuma/auxillary.py @@ -25,6 +25,10 @@ def save_options(options, path, ignore=None): options_copy[i] = 'Removed' + if not os.path.isdir(os.path.dirname(path)): + os.makedirs(os.path.dirname(path)) + + with open(path, 'w') as f: json.dump(options_copy,f, skipkeys=True, indent=4)