From af7ad40bfec4f328649430a18f124c09276cdd8f Mon Sep 17 00:00:00 2001 From: yshtcn Date: Tue, 5 Sep 2023 16:26:09 +0800 Subject: [PATCH] Update heartbeat.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 打包时会自动从临时目录而非当前目录复制配置文件样本 --- heartbeat.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/heartbeat.py b/heartbeat.py index 8a205fa..1629674 100644 --- a/heartbeat.py +++ b/heartbeat.py @@ -120,6 +120,8 @@ image = create_image() config_path = os.path.join(current_dir, 'config.ini') if not os.path.exists(config_path): exsample_config_path = os.path.join(current_dir, 'config.Exsample.ini') + if getattr(sys, 'frozen', False): + exsample_config_path = os.path.join(sys._MEIPASS, 'config.Exsample.ini') shutil.copyfile(exsample_config_path, config_path) # 从配置文件读取设置