Permission error

Hi there! When I run my app locally, it works perfectly but when I deploy it, I get a permission error for one of my files.

Here is a link to my app: Link

PermissionError: [Errno 13] Permission denied: 'lightning/weather/cf-build-AB.exe'

This is the part of the code where it crashes:

self.weather_interpolation_exe_path = 'lightning/weather/cf-build-AB.exe'[self.weather_interpolation_exe_path, self.hmn_weather_massaged_output_path, self.hmn_weather_interpolation_coefficients_path])

I thought maybe it was an issue because it is the exe file of a C file so I changed it to just a regular python file but even then I am getting the same error. Confused on what to do next. Any help would be appreciated. Thank you!

Hi @streamlituser,

It seems like the original error was probably a result of trying to run a Windows executable on Streamlit Community Cloud, which uses a Linux environment.

You mentioned that you saw the same error when you used a Python file – was it the exact same error? And was the path to the file definitely correct?

Yes it was the same error and the path was definitely correct

One thing to consider is that the path will be different when you deploy your app on Streamlit Community Cloud vs. when you’re running your app locally.

You can write the current path via the following: st.write(os.getcwd())

The path will start with /mount/src/ when your app is deployed on Community Cloud.

I wrote the current path with os.getcwd() and got


as the output. My repo name is FireOccurrencePrediction.
I still got the same error when running with a python file:

PermissionError: [Errno 13] Permission denied: 'lightning/weather/'

and same thing when I do it with an absolute path:
PermissionError: [Errno 13] Permission denied: '/mount/src/fireoccurrenceprediction/lightning/weather/'
Another thing I noticed is that whenever the path is wrong I get a FileNotFoundError instead of a PermissionError so I do believe the path is correct.

We have a doc here on invoking a subprocess to run a Python script in your deployed app – I would try using the format suggested there to see if you still get a PermissionError

import streamlit as st
import subprocess
import sys[f"{sys.executable}", ""])

As I mentioned, you won’t be able to run cf-build-AB.exe via Community Cloud since it’s a Linux environment, but you should be able to run a Python file.