Spaces:
Sleeping
Sleeping
| import os | |
| # Force Streamlit to use a writable config directory | |
| os.environ['HOME'] = '/tmp' | |
| os.environ['STREAMLIT_HOME'] = '/tmp/.streamlit' | |
| # Ensure the directory exists | |
| os.makedirs(os.environ['STREAMLIT_HOME'], exist_ok=True) | |
| # You can verify the env vars were set correctly | |
| print("HOME =", os.environ.get("HOME")) | |
| print("STREAMLIT_HOME =", os.environ.get("STREAMLIT_HOME")) | |
| # Now start your Streamlit app logic | |
| import streamlit as st | |
| st.title("Environment Fix Example") | |
| st.write("This Streamlit app should now run without permission errors.") | |