-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
71 lines (49 loc) · 1.46 KB
/
Copy pathmain.py
File metadata and controls
71 lines (49 loc) · 1.46 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import sys
import shutil
import subprocess
import logging
import sys
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def check_quarto():
path = shutil.which("quarto")
if path is None:
raise OSError("Quarto not found in PATH")
logger.info(f"Quarto found at: {path}")
return path
def check_pandoc():
path = shutil.which("pandoc")
if path is None:
raise OSError("Pandoc not found in PATH")
logger.info(f"Pandoc found at: {path}")
return path
def check_python_env():
logger.info(f"Python executable: {sys.executable}")
if sys.prefix == sys.base_prefix:
logger.warning("Not running inside a virtual environment")
return True
def validate_environment():
logger.info("Validating environment...")
check_python_env()
check_quarto()
check_pandoc()
logger.info("All dependencies OK")
def start_gui():
"""
This function can be changed based on gui preference. Then this file is
executed via a .bat file
"""
logger.info('Starting Streamlit GUI')
# Choose whichever option you prefer
subprocess.run([sys.executable,'-m','streamlit','run','st.py'])
# subprocess.run([sys.executable,'-m','gui.py'])
def main():
try:
validate_environment()
# Import GUI only AFTER validation
start_gui()
except Exception as e:
logger.error(f"Startup failed: {e}")
sys.exit(1)
if __name__ == "__main__":
main()