Update heartbeat.py

- 更新当前目录的兼容性,为打包提供支持
This commit is contained in:
yshtcn
2023-09-05 14:48:09 +08:00
committed by GitHub
parent b94f534cf1
commit 54d9c41e76

View File

@@ -14,6 +14,8 @@ import platform
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.realpath(__file__)) current_dir = os.path.dirname(os.path.realpath(__file__))
if getattr(sys, 'frozen', False):
current_dir = sys._MEIPASS # 如果是frozen的即打包后的exe使用这个目录
# 创建日志文件 # 创建日志文件
log_file_path = os.path.join(current_dir, 'heartbeat.log') log_file_path = os.path.join(current_dir, 'heartbeat.log')