- Removed excessive blank lines from multiple Python scripts and configuration files to improve readability and maintainability. - Ensured consistent formatting across the project, contributing to a more organized codebase. - Added new files for testing and analysis, including `test_screenshot_error_handling.py` and `test_screenshot_reuse_optimization.py`, to improve testing coverage and functionality.
48 lines
1.6 KiB
Python
48 lines
1.6 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
import os
|
|
import sys
|
|
import subprocess
|
|
|
|
# 查找目标文件
|
|
target_dir = "pic/debug_captures/2025-12-31"
|
|
if os.path.exists(target_dir):
|
|
files = os.listdir(target_dir)
|
|
# 查找包含关键字的文件
|
|
target_file = None
|
|
for f in files:
|
|
if "152118" in f and "福袋倒计时_分钟" in f and "识别后" in f and "390,1110" in f:
|
|
target_file = f
|
|
break
|
|
|
|
if target_file:
|
|
# 使用绝对路径,避免编码问题
|
|
full_path = os.path.abspath(os.path.join(target_dir, target_file))
|
|
print(f"找到文件: {target_file}")
|
|
print(f"完整路径: {full_path}")
|
|
print(f"文件存在: {os.path.exists(full_path)}")
|
|
print("\n开始运行测试...\n")
|
|
|
|
# 运行测试脚本
|
|
cmd = [sys.executable, "-u", "test_real_parallel_ocr.py", full_path]
|
|
env = os.environ.copy()
|
|
env['PYTHONIOENCODING'] = 'utf-8'
|
|
env['PYTHONUNBUFFERED'] = '1'
|
|
# 实时显示输出
|
|
process = subprocess.Popen(cmd, encoding='utf-8', stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
|
|
text=True, env=env, bufsize=1, universal_newlines=True)
|
|
if process.stdout:
|
|
for line in process.stdout:
|
|
print(line, end='')
|
|
process.wait()
|
|
print(f"\n退出码: {process.returncode}")
|
|
else:
|
|
print("未找到目标文件")
|
|
print("可用文件列表(前10个):")
|
|
for f in files[:10]:
|
|
if "152118" in f:
|
|
print(f" {f}")
|
|
else:
|
|
print(f"目录不存在: {target_dir}")
|
|
|