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/ 而非项目根。
This commit is contained in:
1 parent
f750969df3
commit
2fab3f238e
7 files changed
+40
-12
No files matched your search
@@ -16,7 +16,7 @@ from typing import List
|
||||
|
||||
# 当从 tools 目录直接运行脚本时,Python 的 sys.path[0] 会是 tools/,需要把项目根目录加入路径
|
||||
this_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
project_root = os.path.abspath(os.path.join(this_dir, ".."))
|
||||
project_root = os.path.abspath(os.path.join(this_dir, "..", ".."))
|
||||
if project_root not in sys.path:
|
||||
sys.path.insert(0, project_root)
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
_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.reservation import douyin_reservation_handler as rh
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
_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.douyin_fudai import fudai_analyse
|
||||
from douyin.handlers import douyin_swipe_ops
|
||||
|
||||
|
||||
@@ -15,14 +15,13 @@ if sys.platform == "win32":
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
from douyin.core import path_config
|
||||
_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)
|
||||
|
||||
CONFIG_PATH = path_config.get_config_path()
|
||||
except Exception:
|
||||
from douyin.core import path_config
|
||||
from douyin.core import path_config
|
||||
|
||||
CONFIG_PATH = path_config.get_config_path()
|
||||
CONFIG_PATH = path_config.get_config_path()
|
||||
|
||||
|
||||
def check_conflicts(cfg: dict) -> list:
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
_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.douyin_fudai import fudai_analyse
|
||||
from douyin.utils import douyin_config
|
||||
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
from douyin.core.underlying_operations import underlying_operations
|
||||
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):
|
||||
|
||||
Reference in new issue
Block a user