Unable to find files upon deployment

  1. Are you running your app locally or is it deployed?

App is running fine locally, but not working deployed.

  1. If your app is deployed:
    a. Is it deployed on Community Cloud or another hosting platform?

Community Cloud

b. Share the link to the public deployed app.

  1. Share the link to your app’s public GitHub repository (including a [requirements file]
  1. Share the full text of the error message (not a screenshot).
FileNotFoundError: [Errno 2] No such file or directory: 
'/mount/src/jupyter-notebooks/90_Streamlit_apps/GWP_Well_capture/pages\\\\Bokeh_
Styles.yaml'
  1. Share the Streamlit and Python versions.

python 3.12
streamlit 1.38.0

Description/Issue

I’m trying to understand what I’m missing. A python script relies on several styling files for building an embedded bokeh application. I was not sure how to best point the script to the correct directory where the files were. I have tried os.getcwd() and (currently) os.path.dirname(os.path.realpath(__file__)).

This correctly finds the directory the script that’s running is in, and (you’ll see in Run_Computation.py), that I’m even explicitly printing a list of the files in that directory (and they’re showing up there). BUT, the script is still not finding them (see annotated screengrab).

This is NOT an issue when running locally. So what am I missing here? I’m pretty much a brand new user, so I’m not only looking for a fix but also an explanation/gaining understanding… Thanks…

Would I be correct if I guessed your local development environment is Windows? It appears you have some backslashes in your path handling. Community Cloud is Debian Linux, so you need forward slash path separators (or fully commit to building the paths with a library and don’t try to modify it as a string).

Thank you so much. I knew it had to be something silly like this. I did know about Linux needing forward slashes but a) didn’t realize the community cloud used Linux (should have), and b) I was thrown off by the fact that os.path.dirname(os.path.realpath(__file__)) was returning a path w backslashes on my windows machine… but it wouldn’t on the linux machine, which was hidden from me!

Thanks for taking a look at my silly problem :smiley:

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.