[Errno 2] No such file or directory

Hello,

I want to read this CSV file into a Pandas dataframe but keep getting the above error. I’ve tried creating a shared folder for both the notebook and the CSV but the notebook still can’t find the CSV file. Before this I tried giving the full file path from my Downloads folder. I’ve also tried (‘Polls/generic_ballot_polls.csv’). Any help would be much appreciated.

Thanks!

Start with restarting the kernel and running again. You have a high number next to your cells in the posted images. Any number of things could have happened in what is not shown.

Plus, go under Kernel on the menu bar and choose Shut Down Kernel. Then click on the text where it will now say ‘No Kernel’ in the upper right just above your notebook and then select to attach a new Python kernel. I’ve seen if you use the file navigator to drag a notebook into a different directory after you make the notebook in the originating directory and only restart the kernel, it will actually keep the working directory as the location where you made the notebook initially. No matter how many times you try restarting the kernel when the notebook now is located in a different directory. However, completely shutting down the kernel and attaching a new one will then change the working directory to the present location of the notebook itself.

In your remote MyBinder session, have you run pwd to be sure your working directory is where your notebook and .csv file are?
Likewise, use ls and examine what it shows.
Explore along the lines of the advice here.


I see you are working on a launched session of the JupyterLab demo. One thing I am unclear about is that you mention a ‘Downloads’ folder. That sounds like you are referring to something local to your own machine and not the remote machine where your session is running via MyBinder. The session via MyBinder won’t be able to see your local directories. It looks like you have put the .csv file successfully on the machine running the session and that is what you need to be targeting to open.

1 Like

I shut down and restarted the kernel as you suggested and it’s worked, thank you!

1 Like