2 Easy fixes to Arduino error: “.h: No such file or directory” Are you trying to run an Arduino sketch, but keep coming across a “No such file or directory” error? This is a pretty common error! Aug 27, 2012 'How to Succeed with Linux' I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).
Active2 months ago
This question already has an answer here:
- Python open() gives IOError: Errno 2 No such file or directory 4 answers
I am trying to open a CSV file but for some reason python cannot locate it.
Here is my code (it's just a simple code but I cannot solve the problem):
embert4,27566 gold badges3434 silver badges7171 bronze badges
user3266816user3266816
marked as duplicate by smci, Aran-Fey pythonSep 8 '18 at 22:23
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
6 Answers
When you open a file with the name
address.csv
, you are telling the open()
function that your file is in the current working directory. This is called a relative path.To give you an idea of what that means, add this to your code:
That will print the current working directory along with all the files in it.
Another way to tell the
wjandreaopen()
function where your file is located is by using an absolute path, e.g.:3,68444 gold badges1515 silver badges3535 bronze badges
tsrotentsroten
You are using a relative path, which means that the program looks for the file in the working directory. The error is telling you that there is no file of that name in the working directory.
Try using the exact, or absolute, path.
David HeffernanDavid Heffernan536k3636 gold badges880880 silver badges12881288 bronze badges
For people who are still getting error despite of passing absolute path, should check that if file has a valid name. For me I was trying to create a file with '/' in the file name. As soon as I removed '/', I was able to create the file.
Rajat SoniRajat Soni
DineshDinesh
I encounter this error because the file is empty. This answer may not a correct answer for this question but should give developers a hint like me.
BradBrad1,54111 gold badge1010 silver badges1818 bronze badges
Lets say we have a script in 'c:script.py' that contain :
Lets say that the index.html file is also in the same directory 'c:index.html'when i execute the script from cmd (or shell)
You will get error:
And that because 'index.html' is not in working directory which is 'C:UsersAmine>'. so in order to make it work you have to change the working directory
This is why is it preferable to use absolute path.
AouffenAouffen