Files
douyin_guaji-main/tools/diagnostics/run_screenshot_diagnostics.py
T
Codex 2fab3f238e fix: entry-point scripts douyin.* import 失败 — sys.path 在 import 之后才设置
bin/run_cli.py 的 _BASE_DIR+sys.path.insert 原在 logging import 之后,
导致 No module named 'douyin' 警告。tools/ 下 5 个脚本完全缺失 sys.path
设置,auto_connect_wifi_adb.py 层级算错只跳到 tools/ 而非项目根。
2026-05-23 18:11:18 +08:00

27 lines
786 B
Python

import os
import sys
import time
_PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
if _PROJECT_ROOT not in sys.path:
sys.path.insert(0, _PROJECT_ROOT)
from douyin.core.underlying_operations import underlying_operations
op = underlying_operations()
# try to trigger several screenshots
for i in range(8):
print(f"Triggering screenshot #{i+1}")
ok = op.get_screenshot(device_id="DUMMY_DEVICE", path="pic", use_service=False)
print("result:", ok)
time.sleep(0.6)
print("\n--- Log snippet ---")
try:
with open("logs/screenshot_calls.log", "r", encoding="utf-8") as f:
lines = f.read().splitlines()
for ln in lines[-120:]:
print(ln)
except Exception as e:
print("Could not read log:", e)