dash and training wip
This commit is contained in:
@@ -3,6 +3,34 @@
|
||||
Clean Trading Dashboard Runner with Enhanced Stability and Error Handling
|
||||
"""
|
||||
|
||||
# Ensure we run with the project's virtual environment Python
|
||||
try:
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
import platform
|
||||
|
||||
def _ensure_project_venv():
|
||||
try:
|
||||
project_root = Path(__file__).resolve().parent
|
||||
if platform.system().lower().startswith('win'):
|
||||
venv_python = project_root / 'venv' / 'Scripts' / 'python.exe'
|
||||
else:
|
||||
venv_python = project_root / 'venv' / 'bin' / 'python'
|
||||
|
||||
if venv_python.exists():
|
||||
current = Path(sys.executable).resolve()
|
||||
target = venv_python.resolve()
|
||||
if current != target:
|
||||
os.execv(str(target), [str(target), *sys.argv])
|
||||
except Exception:
|
||||
# If anything goes wrong, continue with current interpreter
|
||||
pass
|
||||
|
||||
_ensure_project_venv()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
import sys
|
||||
import logging
|
||||
import traceback
|
||||
|
Reference in New Issue
Block a user