这是我遇到的错误:
Traceback (most recent call last):
File "E:\stuff\module.py", line 91, in <module>
f = open('E:/stuff/log.txt')
IOError: [Errno 2] No such file or directory: 'E:/stuff/log.txt'
这是我的代码:
f = open('E:/stuff/log.txt')
E:/stuff/log.txt
文件已存在。我可以在Windows资源管理器中导航并打开它,那么为什么我不能打开它?
编辑:
DIR命令的输出:
C:\Documents and Settings\Administrator>dir e:\stuff
Volume in drive E has no label.
Volume Serial Number is 5660-4957
Directory of e:\stuff
23. 10. 2010 09:26 <DIR> .
23. 10. 2010 09:26 <DIR> ..
19. 10. 2010 20:07 385 index.py
23. 10. 2010 16:12 1 954 module.py
22. 10. 2010 19:16 8 335 backprop.py
19. 10. 2010 20:54 1 307 backprop-input.gif
19. 10. 2010 01:48 310 HelloWorld.kpf
23. 10. 2010 15:47 0 log.txt.txt
6 File(s) 12 291 bytes
2 Dir(s) 8 795 586 560 bytes free
C:\Documents and Settings\Administrator>dir e:\
Volume in drive E has no label.
Volume Serial Number is 5660-4957
Directory of e:\
16. 10. 2010 13:32 <DIR> development-tools
23. 10. 2010 09:26 <DIR> stuff
0 File(s) 0 bytes
2 Dir(s) 8 795 586 560 bytes free
我正在通过cmd运行python脚本,命令如下:
python E:\stuff\module.py
log.txt.txt
和log.txt
不一样,是吗? - SilentGhost