0

Error when opening a file

when I try opening a file using the right syntax, I get a FileNotFoundError which says : No such file or directory

14th Jul 2017, 3:27 PM
Elijah Arhinful
Elijah Arhinful - avatar
2 Antworten
+ 3
Verify that your path is right, and if not absolute, verify that the current working directory is the one you think by adding these lines in your script: import os print(os.getcwd()) Anyway, if you search the path of the running script file (which is not necessarly the current working directory), you can get it by this way: print(os.path.dirname(os.path.realpath(__file__))
14th Jul 2017, 4:38 PM
visph
visph - avatar
+ 2
Its likely that your path to the file is incorrect
14th Jul 2017, 3:35 PM
S C