From 50c7555c45283afdba7d80d90be574a8431c566e Mon Sep 17 00:00:00 2001 From: 3093FengMing <83573615+3093FengMing@users.noreply.github.com> Date: Tue, 20 Feb 2024 12:31:49 +0800 Subject: [PATCH] 1.3fix --- WorldTranslationExtractor.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/WorldTranslationExtractor.py b/WorldTranslationExtractor.py index 87917ef..b4f5631 100644 --- a/WorldTranslationExtractor.py +++ b/WorldTranslationExtractor.py @@ -577,12 +577,15 @@ def main(): | 使用Amulet核心 | +==================================+ ''') - with open("config.json", "r", encoding="utf-8") as file_cfg: - global cfg_settings, cfg_dupe, cfg_lang - config = json.loads(file_cfg.read()) - cfg_settings = config["settings"] - cfg_dupe = cfg_settings["keep_duplicate_keys"] - cfg_lang = cfg_settings["lang"] + try: + with open("config.json", "r", encoding="utf-8") as file_cfg: + global cfg_settings, cfg_dupe, cfg_lang + config = json.loads(file_cfg.read()) + cfg_settings = config["settings"] + cfg_dupe = cfg_settings["keep_duplicate_keys"] + cfg_lang = cfg_settings["lang"] + except Exception as e: + print("在打开config.json时发生一个错误: /An error occurred while opening the file config.json: ", e) if len(sys.argv) < 2: print(f"用法: python {sys.argv[0]} <存档>/Usage: python {sys.argv[0]} ")