From 8a89813ef4d040db29457782c43739ed4fce9b8c Mon Sep 17 00:00:00 2001 From: w-e-w <40751091+w-e-w@users.noreply.github.com> Date: Fri, 26 Jan 2024 17:16:53 +0900 Subject: [PATCH] minor fix to #14525 --- modules/launch_utils.py | 1 - modules/options.py | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/launch_utils.py b/modules/launch_utils.py index 8e58d714550..3ff4576a382 100644 --- a/modules/launch_utils.py +++ b/modules/launch_utils.py @@ -251,7 +251,6 @@ def list_extensions(settings_file): except Exception: errors.report(f'\nCould not load settings\nThe config file "{settings_file}" is likely corrupted\nIt has been moved to the "tmp/config.json"\nReverting config to default\n\n''', exc_info=True) os.replace(settings_file, os.path.join(script_path, "tmp", "config.json")) - settings = {} disabled_extensions = set(settings.get('disabled_extensions', [])) disable_all_extensions = settings.get('disable_all_extensions', 'none') diff --git a/modules/options.py b/modules/options.py index ff2000c6adb..b1f96a1cfba 100644 --- a/modules/options.py +++ b/modules/options.py @@ -198,6 +198,8 @@ def load(self, filename): try: with open(filename, "r", encoding="utf8") as file: self.data = json.load(file) + except FileNotFoundError: + self.data = {} except Exception: errors.report(f'\nCould not load settings\nThe config file "{filename}" is likely corrupted\nIt has been moved to the "tmp/config.json"\nReverting config to default\n\n''', exc_info=True) os.replace(filename, os.path.join(script_path, "tmp", "config.json"))