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

Allows relative paths for diagnostic scripts. #2329

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
8 changes: 7 additions & 1 deletion esmvalcore/_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,15 @@ def _initialize_cmd(self):
"""Create an executable command from script."""
diagnostics_root = DIAGNOSTICS.scripts
script = self.script
script_file = (diagnostics_root / Path(script).expanduser()).absolute()

# Check if local diagnostic path exists
script_file = Path(script).expanduser().absolute()
err_msg = f"Cannot execute script '{script}' ({script_file})"
if not script_file.is_file():
# Try diagnostics_root
script_file = (
diagnostics_root / Path(script).expanduser()
).absolute()
if not script_file.is_file():
raise DiagnosticError(f"{err_msg}: file does not exist.")

Expand Down