refactor(web_viewer): update project root path for subprocess execution

Adjusts the project root path calculation in `app.py` to accommodate changes in how the script is executed as a subprocess. This ensures proper imports of shared and module components without affecting existing functionality.
This commit is contained in:
agessaman
2026-05-18 21:20:51 -07:00
parent 8a65f48028
commit a71c262307
+4 -4
View File
@@ -19,10 +19,10 @@ from pathlib import Path
from typing import Any
from urllib.parse import urlparse
# When started as a script (`python modules/web_viewer/app.py`), Python puts the
# script's directory on sys.path, not the repo root — import modules.* fails
# unless we prepend the project root first.
_project_root = str(Path(__file__).resolve().parent.parent.parent)
# When started as a subprocess (`python web_viewer/app.py`), Python puts the
# script's directory on sys.path, not the repo root — imports of shared.* and
# modules.* fail unless we prepend the project root first.
_project_root = str(Path(__file__).resolve().parent.parent)
if _project_root not in sys.path:
sys.path.insert(0, _project_root)