Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid breaking Python environment by prepending CIME paths to PYTHONPATH #4683

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions CIME/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,12 +820,10 @@ def run_cmd(
# or build a relative path and append `sys.path` to import
# `standard_script_setup`. Providing `PYTHONPATH` fixes protential
# broken paths in external python.
env.update(
{
"CIMEROOT": f"{get_cime_root()}",
"PYTHONPATH": f"{get_cime_root()}:{get_tools_path()}",
}
)
env_pythonpath = os.environ.get("PYTHONPATH", "").split(":")
cime_pythonpath = [f"{get_cime_root()}", f"{get_tools_path()}"] + env_pythonpath
env["PYTHONPATH"] = ":".join(filter(None, cime_pythonpath))
env["CIMEROOT"] = f"{get_cime_root()}"

if timeout:
with Timeout(timeout):
Expand Down
Loading