Application deployment

Hi guys I have recently designed a web application for our hospital it ran successfully on the local host however when I tried to deploy on streamlit cloud it consistently returned an error that no such file (the data source) exists I tried repeatedly but to no avail may you help me fix this problem Have a look at the attached picture
Thanks in advance

Hey @Mohammed_Bahageel,

It looks like your app’s get_data() method can not open and read an Excel file at path data\\datasethospital.xlsx.

Apparently, the file was not found in the given path.

  1. Did you include the file in the GitHub repository?
  2. If yes, and if you put it into a directory called data, make sure to provide a path that is OS-agnostic like:
from pathlib import Path
path = Path("data") / "datasethospital.xlsx"

Hope that helps!

Yes I transferred the data sheet into the same repository

Please understand me my bro The app ran successfully on the local host this indicates that there is no problem with coding
However when I tried to run it streamlit cloud it returned that message although I pushed all the required files into GitHub repository including the data

Backslashes in files paths will not work on Streamlit Cloud. Your file path may work on a local, Windows environment using backslashes, but Streamlit Cloud is Debian. That is a key part of “OS-agnostic.”

Another way to do what @arnaud said is to use:

./data/datasethospital.xlsx for your path. Both Windows and Streamlit Cloud will understand the forward slashes.

1 Like