Spaces:
Runtime error
Runtime error
Commit ·
72d70ca
1
Parent(s): 64a490d
fix: add openenv back; catch BaseException to surface crash cause
Browse files- requirements.txt +1 -0
- streamlit_app.py +9 -12
requirements.txt
CHANGED
|
@@ -14,3 +14,4 @@ scipy>=1.12.0
|
|
| 14 |
matplotlib>=3.8.0
|
| 15 |
click>=8.0.0
|
| 16 |
python-dotenv>=1.0.0
|
|
|
|
|
|
| 14 |
matplotlib>=3.8.0
|
| 15 |
click>=8.0.0
|
| 16 |
python-dotenv>=1.0.0
|
| 17 |
+
openenv>=0.1.0
|
streamlit_app.py
CHANGED
|
@@ -1,21 +1,18 @@
|
|
| 1 |
-
import sys, os, traceback
|
| 2 |
import streamlit as st
|
|
|
|
| 3 |
from pathlib import Path
|
| 4 |
-
import importlib.util
|
| 5 |
|
| 6 |
root = Path(__file__).resolve().parent
|
| 7 |
sys.path.insert(0, str(root))
|
| 8 |
os.chdir(str(root))
|
| 9 |
|
| 10 |
-
demo_file = root / "demo" / "streamlit_app.py"
|
| 11 |
-
|
| 12 |
try:
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
except
|
| 20 |
-
st.error(f"SpindleFlow failed
|
| 21 |
st.code(traceback.format_exc())
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
import sys, os, traceback
|
| 3 |
from pathlib import Path
|
|
|
|
| 4 |
|
| 5 |
root = Path(__file__).resolve().parent
|
| 6 |
sys.path.insert(0, str(root))
|
| 7 |
os.chdir(str(root))
|
| 8 |
|
|
|
|
|
|
|
| 9 |
try:
|
| 10 |
+
demo = root / "demo" / "streamlit_app.py"
|
| 11 |
+
with open(demo, encoding="utf-8") as f:
|
| 12 |
+
code = f.read()
|
| 13 |
+
exec(compile(code, str(demo), "exec"), {"__file__": str(demo), "__name__": "__main__"})
|
| 14 |
+
except SystemExit:
|
| 15 |
+
pass
|
| 16 |
+
except BaseException as e:
|
| 17 |
+
st.error(f"SpindleFlow failed: {e}")
|
| 18 |
st.code(traceback.format_exc())
|