From 1bcbd6501bb3e5db5674a18a8a8074034cda318b Mon Sep 17 00:00:00 2001 From: lllyasviel Date: Sat, 27 Jan 2024 16:18:26 -0800 Subject: [PATCH] fix config --- modules/config.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/config.py b/modules/config.py index 7feae8f0..58107806 100644 --- a/modules/config.py +++ b/modules/config.py @@ -16,10 +16,17 @@ config_dict = {} always_save_keys = [] visited_keys = [] +try: + with open(os.path.abspath(f'./presets/default.json'), "r", encoding="utf-8") as json_file: + config_dict.update(json.load(json_file)) +except Exception as e: + print(f'Load default preset failed.') + print(e) + try: if os.path.exists(config_path): with open(config_path, "r", encoding="utf-8") as json_file: - config_dict = json.load(json_file) + config_dict.update(json.load(json_file)) always_save_keys = list(config_dict.keys()) except Exception as e: print(f'Failed to load config file "{config_path}" . The reason is: {str(e)}') @@ -79,13 +86,6 @@ def try_load_deprecated_user_path_config(): try_load_deprecated_user_path_config() -try: - with open(os.path.abspath(f'./presets/default.json'), "r", encoding="utf-8") as json_file: - config_dict.update(json.load(json_file)) -except Exception as e: - print(f'Load default preset failed.') - print(e) - preset = args_manager.args.preset if isinstance(preset, str):