FileNotFoundError: [Errno 2] No such file or directory: 'FSnm.png'

Hello I have found the solution for this, even if your files are in the same folder the error persists , the picture file or file that it says no directory found must not be in any folder, it should be directly on the first page, where you see when you open the repository, because irrespective of where the main file is, thatā€™s where it is relative to.

1 Like

I had a similar issue with a file not found error. I was puzzled.

I found out that I got the error from uploading the files to Github inside of a folder. Instead I had to upload the files to Github individually.

You can have folders such as pages etc. you just canā€™t have the main file, png etc. inside of a directory when you upload. I hope this helps.

Hi I am having a similar issue and I was wondering if you could help me out as well?

Hi what do you mean by first page? Thanks

Those whoa re getting error of No such file directory ,put all exact location.

This method is useful, thanks. But I am confused that this path is equivalent to my absolute path and the latter is canā€™t run.

Hi @Hughes and welcome!

Can you provide more details about what wonā€™t run? Have you used st.write(my_file) to inspect the path that is constructed in the quoted snippet? That is an easy way to confirm if there is some small difference. Depending on the system executing your code, there may be a subtle detail like the difference between forward and back slashes.

i have same problem ```
FileNotFoundError: [Errno 2] No such file or directory: ā€˜c:\jptur1.csvā€™
this is my appā€¦
st.text_input(ā€œenter a textā€)

st.text_area(ā€œenter a paragraphā€)

st.file_uploader(ā€œuplode a afileā€)

st.camera_input(ā€œtaake a photoā€)

st.date_input(ā€œtodayā€)

st.time_input(ā€œnowā€)

st.number_input(ā€œnumā€)

st.color_picker(ā€œcolorsā€)

df=pd.read_csv(rā€™c:\jptur1.csvā€™,encoding=ā€˜unicode_escapeā€™)

st.write(df)

every thing is o k but in the deployment when go to the path the problem happened
thanks

This will not work, you donā€™t have access to your clients file system on streamit cloud.
Put the file in your github repo and change the line to:

df = pd.read_csv("jptur1.csv", encoding="unicode_escape")