Help needed on this Error: No such file or directory

My App is working well on my locally but when I try deploying it on Streamlit, I am getting this error:
No such file or directory: os.chdir(r"C:\Users\varte\OneDrive\Desktop\Data Science Course\Final\final_project")

Again, this App works well on my local computer.

Hi @Levis_Kerzuah

It seems that you are using a local path

which is recognized locally but is not recognized when deployed on Community Cloud.

You can change this to a relative path and the app should work normally.

where will I change it? In my git repository? Please help me out.


The easiest approach is to use the default root path that is you’re specifying only the file name when wanting to access it. For example, to use pandas to access a CSV file, you can use

df = pd.read_csv('data.csv')

Or if you want to define a relative path to a folder (hypothethically called folder_name) that resides in the root path you can use:

df = pd.read_csv('folder_name/data.csv')

And yes, since you’re deploying the app to the Community Cloud, you’ll need to make changes to the file that resides in your GitHub repo that was used for deploying the app.

Hope this helps!