entropy1
entropy1

Reputation: 35

Error while trying to open CSV file in python

Python rookie here. Trying to use the CSV module, but I get an error:

IOError: [Errno 2] No such file or directory: 'books.csv'

The actual CSV file is stored on my desktop. I suppose this means Python can't find the file? If so, how can I fix this?

Many thanks in advance!

Upvotes: 0

Views: 13276

Answers (1)

Spencer Rathbun
Spencer Rathbun

Reputation: 14900

Since your file name includes no path component, it is implicitly assigned to be in the current directory. Unless your current directory is the desktop, you won't be able to find the file.

Either give it a full pathname, or move to the desktop and run your script from there.

Upvotes: 3

Related Questions