From 5b04dbf66fb1bce5d04bb621923f5c427b0b1a33 Mon Sep 17 00:00:00 2001 From: Andrew Liggett Date: Tue, 2 Aug 2022 15:07:02 -0700 Subject: [PATCH] Changed the bug fix to adding an if statement to check if filename ends with '.json'. --- atef/widgets/config.py | 4 +++- demo-configs/my_filename.json.json | 3 --- 2 files changed, 3 insertions(+), 4 deletions(-) delete mode 100644 demo-configs/my_filename.json.json diff --git a/atef/widgets/config.py b/atef/widgets/config.py index 3746ac01..1b94ff6c 100644 --- a/atef/widgets/config.py +++ b/atef/widgets/config.py @@ -185,8 +185,10 @@ def save_as(self, *args, filename: Optional[str] = None, **kwargs): caption='Save as', filter='Json Files (*.json)', ) + if filename.endswith('.json') is False: # json_extension_bug_fix location + filename += '.json' try: - with open(filename+'.json', 'w') as fd: ## json_extension_bug_fix location + with open(filename, 'w') as fd: json.dump(serialized, fd, indent=2) except OSError: logger.exception(f'Error saving file {filename}') diff --git a/demo-configs/my_filename.json.json b/demo-configs/my_filename.json.json deleted file mode 100644 index 9751497c..00000000 --- a/demo-configs/my_filename.json.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "configs": [] -} \ No newline at end of file