Skip to content
Advertisement

No such file or directory error

This is the error I am getting:

JavaScript

And this is my code:

JavaScript

The E:/stuff/log.txt file exists. I can navigate in Windows Explorer and open it so why can’t I open it?

EDIT:

Output of DIR command:

JavaScript

I am running the python script from the cmd like this:

JavaScript

Advertisement

Answer

Firstly, from above, Windows supports / just fine.

Secondly: Well, if you look at your file, you’ll notice it’s not log.txt, it’s log.txt.txt… You may see it as “log.txt” in your graphical folder viewer (as opposed to the CLI “dir” command) simply because it hides the known file extensions.

I recommend you disable this – see folder options, there should be an option “Hide extensions of known file types” (or similar).

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement