更新进程的处理逻辑,避免在打包后出现运行的异常。
This commit is contained in:
@@ -140,7 +140,7 @@ class LogManager:
|
|||||||
fail_items.append(f"{messageappend})")
|
fail_items.append(f"{messageappend})")
|
||||||
|
|
||||||
# 写入SN统计信息
|
# 写入SN统计信息
|
||||||
f.write(f" SN {sn}: 文件数={file_count}, Cell数={len(cells)}, FAIL数={fail_count}\n")
|
f.write(f" SN {sn}: 文件数={file_count}, Cells={','.join(cells)}, FAIL数={fail_count}\n")
|
||||||
|
|
||||||
# 如果有失败项,写入失败详情
|
# 如果有失败项,写入失败详情
|
||||||
if fail_items:
|
if fail_items:
|
||||||
@@ -1544,7 +1544,10 @@ class ReportProcessor:
|
|||||||
print(f"{Fore.YELLOW}{warning_msg}")
|
print(f"{Fore.YELLOW}{warning_msg}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
# 在文件末尾替换现有的 if __name__ == "__main__": 代码块
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""主程序入口点"""
|
||||||
try:
|
try:
|
||||||
processor = ReportProcessor()
|
processor = ReportProcessor()
|
||||||
|
|
||||||
@@ -1561,3 +1564,19 @@ if __name__ == "__main__":
|
|||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
import multiprocessing as mp
|
||||||
|
|
||||||
|
# 关键:防止打包环境下的重复执行
|
||||||
|
mp.freeze_support()
|
||||||
|
|
||||||
|
# 额外保护:确保只在主进程中执行
|
||||||
|
if mp.current_process().name == 'MainProcess':
|
||||||
|
main()
|
||||||
|
input(f"输入任意结束程序......")
|
||||||
|
else:
|
||||||
|
# 子进程不需要执行任何交互代码
|
||||||
|
pass
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user