|
48 | 48 | logger.addHandler(h) |
49 | 49 |
|
50 | 50 | # --------------------------- |
51 | | -# Ensure src of project is importable (robust) |
| 51 | +# Ensure src of project is importable |
52 | 52 | # --------------------------- |
53 | | -# Candidate locations to find your project 'src' folder on Streamlit Cloud or local dev |
| 53 | +# The script is running from /path/to/streamlit_app/pages/volatility_surface.py |
| 54 | +# The src folder is at /path/to/src |
| 55 | +# So we need to go up from pages/ to streamlit_app/, then up again to the project root (where src is). |
54 | 56 | CANDIDATE_SRC = [ |
55 | | - Path(__file__).resolve().parent / ".." / "src", # Go up from pages/ to streamlit_app/, then to src/ |
56 | | - Path(__file__).resolve().parent.parent / "src", # Go up two levels from pages/ (e.g., if running from a deeper structure) |
| 57 | + Path(__file__).resolve().parent.parent / "src", # Go up two levels from pages/ -> streamlit_app -> src/ |
| 58 | + Path(__file__).resolve().parent / ".." / "src", # Go up from pages/ to streamlit_app/, then to src/ (this might also work depending on sys.path) |
57 | 59 | Path.cwd() / "src", |
58 | 60 | Path("src"), |
59 | 61 | # Your machine path example (keeps safe if not present) |
|
70 | 72 |
|
71 | 73 | if SRC_DIR is None: |
72 | 74 | logger.warning("Could not find 'src' directory in candidate paths. Project models may not be available.") |
73 | | - # --- FIX: Initialize PROJECT_MODELS_AVAILABLE to False if src not found --- |
| 75 | + # Initialize PROJECT_MODELS_AVAILABLE to False if src not found |
74 | 76 | PROJECT_MODELS_AVAILABLE = False |
75 | 77 | _project_import_error = "SRC directory not found." |
76 | 78 | ProjectMLPModel = ProjectRFModel = ProjectSVRModel = ProjectXGBModel = None |
|
102 | 104 | logger.warning("Project models not importable: %s", _project_import_error) |
103 | 105 | ProjectMLPModel = ProjectRFModel = ProjectSVRModel = ProjectXGBModel = None |
104 | 106 |
|
105 | | - |
106 | 107 | # --------------------------- |
107 | 108 | # App constants & storage |
108 | 109 | # --------------------------- |
|
0 commit comments