- Add paths.py: BASE_DIR/DOWNLOAD_DIR/CONFIG_PATH anchored on __file__ so paths resolve regardless of the launch cwd - Route main_router and all site modules through DOWNLOAD_DIR/CONFIG_PATH, replacing os.getcwd()-based download dirs and the "config.yaml" literal - main_router compare engine: read Excel as str with keep_default_na, strip/normalize 运单号, drop blanks, and isin against a set so int/float-vs-str mismatches no longer produce false "undelivered" - Shunxin: give downloaded files unique microsecond temp names and read Excel as str to preserve long-waybill precision - Normalize bare except: to except Exception: across affected files Co-Authored-By: Claude <noreply@anthropic.com>
16 lines
751 B
Python
16 lines
751 B
Python
# paths.py
|
||
# 统一的路径锚点:所有路径都以本项目所在目录为基准,避免依赖运行时的工作目录(cwd)。
|
||
# 这样无论从哪个目录启动脚本(IDE / 命令行 / 计划任务 / 双击),
|
||
# 下载目录与配置文件都能稳定定位,不会出现“文件落到别处”或“读不到密码”的隐蔽故障。
|
||
|
||
import os
|
||
|
||
# 项目根目录(以本文件所在位置为基准,与从哪个目录启动脚本无关)
|
||
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||
|
||
# 统一的下载 / 输出目录
|
||
DOWNLOAD_DIR = os.path.join(BASE_DIR, "downloads")
|
||
|
||
# 统一的配置文件路径(注意:config.yaml 需与本项目脚本放在同一目录下)
|
||
CONFIG_PATH = os.path.join(BASE_DIR, "config.yaml")
|