mirror of
https://github.com/agessaman/meshcore-bot.git
synced 2026-06-04 06:41:21 +00:00
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:
+4
-4
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user