error "no such file or directory" when reading in csv file in python
Your code is using a relative path; python is looking in the current directory (whatever that may be) to load your file. What the current directory is depends on how you started your Python script and if you executed any code that may have changed the current working directory.
Use a full absolute path instead:
path = r'C:\Documents and Settings\eag29278\My Documents\python test code\test_satdata.csv'
with open(path, 'rb') as csvfile:
Using 'rb'
is entirely correct, the csv
module recommends you do so:
If csvfile is a file object, it must be opened with the ‘b’ flag on platforms where that makes a difference.
Windows is such a platform.