Ah, that's the issue! The error shows the path as C:\Users\knolseb\dev\ScalableSAA_engine\ but you're actually working in C:\Users\knolseb\dev\ScalableSAA\ScalableSAA_engine\. This means your current working directory is not what you expect it to be.
Here's how to debug and fix this:
1. Check your current working directory
Add this at the beginning of your script to see where Python thinks it's running:
import os
print(f"Current working directory: {os.getcwd()}")
print(f"Script location: {os.path.dirname(os.path.abspath(__file__))}")
2. The problem is likely here:
json_path = os.path.abspath('cache/cache.json')
This creates an absolute path based on the current working directory, not the script's location.
3. Fix it by using the script's directory as the base:
# Get the directory where this script is located
script_dir = os.path.dirname(os.path.abspath(__file__))
json_path = os.path.join(script_dir, 'cache', 'cache.json')
Or if you want to ensure you're always working from your project root:
# Force the working directory to be your project root
project_root = r"C:\Users\knolseb\dev\ScalableSAA\ScalableSAA_engine"
os.chdir(project_root)
json_path = os.path.abspath('cache/cache.json')
4. Add debugging to see what paths are being used:
if st.button("🎯 Generate Slides", type="primary", use_container_width=True):
with st.spinner("Generating presentation... This may take a moment."):
try:
# Debug: Show current working directory and paths
st.info(f"Current working directory: {os.getcwd()}")
# Get the SAA instance
script_dir = os.path.dirname(os.path.abspath(__file__))
json_path = os.path.join(script_dir, 'cache', 'cache.json')
st.info(f"Using JSON path: {json_path}")
saa = ScalableSAA(json_path)
# ... rest of your code
The issue is that when you run your Streamlit app, the current working directory is probably set to C:\Users\knolseb\dev\ScalableSAA_engine instead of your actual project directory C:\Users\knolseb\dev\ScalableSAA\ScalableSAA_engine. This causes all relative paths to resolve to the wrong location.