garvitsachdeva Claude Sonnet 4.6 commited on
Commit
72d70ca
·
1 Parent(s): 64a490d

fix: add openenv back; catch BaseException to surface crash cause

Browse files
Files changed (2) hide show
  1. requirements.txt +1 -0
  2. 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
- spec = importlib.util.spec_from_file_location("spindleflow_demo", str(demo_file))
14
- mod = importlib.util.module_from_spec(spec)
15
- mod.__file__ = str(demo_file)
16
- sys.modules["spindleflow_demo"] = mod
17
- spec.loader.exec_module(mod)
18
- mod.main()
19
- except Exception as e:
20
- st.error(f"SpindleFlow failed to load: {e}")
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())