Skip to content

fix: OMNIMEMEVAL_ENV_FILE 路径在 Windows/git-bash 下不可用 - #5

Open
wefio wants to merge 1 commit into
MemTensor:mainfrom
wefio:fix/windows-env-path
Open

fix: OMNIMEMEVAL_ENV_FILE 路径在 Windows/git-bash 下不可用#5
wefio wants to merge 1 commit into
MemTensor:mainfrom
wefio:fix/windows-env-path

Conversation

@wefio

@wefio wefio commented Aug 4, 2026

Copy link
Copy Markdown

改了什么(What changed)

scripts/_experiment_utils.shextract_env_arg 中,环境文件路径由 pwd 生成。git-bash(MSYS2)下 pwd 输出 POSIX 风格路径(/c/...),Windows 原生 Python 打不开——python-dotenvload_dotenv() 静默返回 False,导致 NMG_ROOT/ANSWER_MODEL 等环境变量从未加载,run_*_eval.sh 全部静默缺配置运行。

改动(2 处:--env--replay 路径):

pwdpwd -W 2>/dev/null || pwd
  • git-bash 下 pwd -W 输出 Windows 路径(C:/...),Python 可正常打开
  • Linux/macOS/WSL 下 pwd -W 不存在,自动回退普通 pwd,行为不变

验证(Tested)

Windows + git-bash:load_dotenv 成功、ANSWER_MODEL 正常加载;Linux 回退不受影响。


English: extract_env_arg built the env-file path with plain pwd, which emits POSIX paths (/c/...) under git-bash; Windows Python silently fails to open them (python-dotenv returns False), so env vars were never loaded. Fix: pwd -W 2>/dev/null || pwd (2 places) — Windows paths on git-bash, unchanged fallback elsewhere. Tested on Windows git-bash (loads correctly); Linux unaffected.

extract_env_arg builds the env-file path with plain 'pwd', which in
git-bash (MSYS2) emits POSIX paths (/c/...). Native Windows Python then
silently fails to open them — python-dotenv's load_dotenv returns False
without raising — so NMG_ROOT/ANSWER_MODEL etc. are never loaded and
every run_*_eval.sh silently runs with missing config.

MSYS2 auto-converts command-line arguments to Windows paths but NOT
environment variables, and the env-file path crosses bash -> python via
an env var, so it stays in POSIX form.

Fix: pwd -W 2>/dev/null || pwd
- pwd -W (MSYS extension) emits Windows paths (C:/...) that Windows
  Python can open.
- On Linux/macOS/WSL, pwd -W fails, the error is swallowed, and plain
  pwd runs — behaviour is unchanged. Cross-platform, no WSL dependency.

Applies to both injection points: --env and --replay env-file paths.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant