This is the error I am getting:
JavaScript
x
5
1
Traceback (most recent call last):
2
File "E:stuffmodule.py", line 91, in <module>
3
f = open('E:/stuff/log.txt')
4
IOError: [Errno 2] No such file or directory: 'E:/stuff/log.txt'
5
And this is my code:
JavaScript
1
2
1
f = open('E:/stuff/log.txt')
2
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
1
30
30
1
C:Documents and SettingsAdministrator>dir e:stuff
2
Volume in drive E has no label.
3
Volume Serial Number is 5660-4957
4
5
Directory of e:stuff
6
7
23. 10. 2010 09:26 <DIR> .
8
23. 10. 2010 09:26 <DIR> ..
9
19. 10. 2010 20:07 385 index.py
10
23. 10. 2010 16:12 1 954 module.py
11
22. 10. 2010 19:16 8 335 backprop.py
12
19. 10. 2010 20:54 1 307 backprop-input.gif
13
19. 10. 2010 01:48 310 HelloWorld.kpf
14
23. 10. 2010 15:47 0 log.txt.txt
15
6 File(s) 12 291 bytes
16
2 Dir(s) 8 795 586 560 bytes free
17
18
19
20
C:Documents and SettingsAdministrator>dir e:
21
Volume in drive E has no label.
22
Volume Serial Number is 5660-4957
23
24
Directory of e:
25
26
16. 10. 2010 13:32 <DIR> development-tools
27
23. 10. 2010 09:26 <DIR> stuff
28
0 File(s) 0 bytes
29
2 Dir(s) 8 795 586 560 bytes free
30
I am running the python script from the cmd like this:
JavaScript
1
2
1
python E:stuffmodule.py
2
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).