-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlaunch.py
More file actions
30 lines (23 loc) · 778 Bytes
/
Copy pathlaunch.py
File metadata and controls
30 lines (23 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python3
"""
launch.py — run this instead of `streamlit run src/ui/app.py`
python /mnt/w/SecGraph-AI/launch.py
Sets PYTHONPATH at the OS environment level BEFORE the subprocess starts,
so Streamlit's own sys.path manipulation cannot remove it.
"""
import os
import sys
import subprocess
from pathlib import Path
SRC = Path(__file__).resolve().parent / "src"
env = os.environ.copy()
existing = env.get("PYTHONPATH", "")
env["PYTHONPATH"] = f"{SRC}:{existing}" if existing else str(SRC)
app = SRC / "ui" / "app.py"
print(f"PYTHONPATH = {env['PYTHONPATH']}")
print(f"Launching : streamlit run {app}\n")
result = subprocess.run(
[sys.executable, "-m", "streamlit", "run", str(app)] + sys.argv[1:],
env=env,
)
sys.exit(result.returncode)