check for src axolotl in PYTHONPATH before removing it

This commit is contained in:
Wing Lian
2025-02-06 13:26:23 -05:00
parent 3d38bc82b8
commit 4f9c57e95d
2 changed files with 4 additions and 1 deletions

View File

@@ -23,7 +23,10 @@ def run_cmd(cmd: str, run_folder: str, volumes=None):
# modal workaround so it doesn't use the automounted axolotl
new_env = copy.deepcopy(os.environ)
if "PYTHONPATH" in new_env:
del new_env["PYTHONPATH"]
python_path = Path(new_env["PYTHONPATH"].split(":")[0])
if python_path.joinpath("src", "axolotl").exists():
# we don't want to use the automounted axolotl or unexpected behavior happens
del new_env["PYTHONPATH"]
# Propagate errors from subprocess.
if exit_code := subprocess.call( # nosec B603

View File