FileNotFoundError: [Errno 2] No such file or directory: ‘submission/submission.csv’

I get the following error on my submissions.

My zip file has the following contents (after unzipping):


ls submission/
notebook.ipynb  submission.csv

Basically it is zipped by zip -r submission.zip submission

I also tried submitting only zipped submission.csv but it also doesn’t work.

Hi @jakub_bartczuk,

Looks like you are running and creating solution zip locally for your submission (instead of notebook submission).
You are just at the last mile! :raised_hands:

Instead of zipping with folder name i.e.

zip -r submission.zip submission

You can go inside submission folder and zip as:

zip -r submission.zip *

[or]

zip -r submission.zip notebook.ipynb submission.csv

NOTE: You need to include both your ipynb notebook and csv submission file in your submission.

1 Like

Python FileNotFoundError means you are trying to open a file that does not exist in the specified directory. When you open a file with the file name , you are telling the open() function that your file is in the current working directory. This is called a relative path. If the user does not pass the full path to the file (on Unix type systems this means a path that starts with a slash), the path is interpreted relatively to the current working directory. The current working directory usually is the directory in which you started the program. A good start would be validating the input. In other words, you can make sure that the user has indeed typed a correct path for a real existing file, like this:

while not os.path.isfile(fileName):
    fileName = input("Whoops! No such file! Please enter the name of the file you'd like to use.")

Another way to tell the python file open() function where your file is located is by using an absolute path, e.g.:

f = open("/Users/foo/filename")

In any case, if your Python script file and your data input file are not in the same directory, you always have to specify either a relative path between them or you have to use an absolute path for one of them.

1 Like