Skip to content

Commit b27755a

Browse files
fix: use try/except for relative+absolute import in pidmayuresh3 wrapper
Apply Copilot review suggestion — try relative import first (from .pidmayuresh) for package-style usage, with fallback to absolute import for direct script execution.
1 parent 52b0c3b commit b27755a

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

tools/pidmayuresh3.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@
2020

2121
# Re-execute the canonical module so run-time behaviour is identical
2222
# when this file is invoked directly (e.g., via a study graph).
23-
from pidmayuresh import * # noqa: F401,F403
23+
try:
24+
# Prefer relative import when part of the tools package
25+
from .pidmayuresh import * # type: ignore[attr-defined] # noqa: F401,F403
26+
except ImportError:
27+
# Fallback for script-style execution (e.g., `python tools/pidmayuresh3.py`)
28+
from pidmayuresh import * # noqa: F401,F403
2429

2530

2631

0 commit comments

Comments
 (0)