Misleading error message when opening a file (on Windows XP SP 2)
Fredrik Lundh
fredrik at pythonware.com
Mon Aug 28 06:07:57 EDT 2006
Tim Peters wrote:
> Assuming the file exists and isn't read-only, I bet it's a Windows
> bug, and that if you open in binary mode ("r+b") instead I bet it goes
> away (this wouldn't be the first large-file text-mode Windows bug).
> dir bigfile.dat
2006-08-28 11:46 5 000 000 000 bigfile.dat
>>> f = file("bigfile.dat", "r")
>>> f = file("bigfile.dat", "r+")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IOError: [Errno 2] No such file or directory: 'bigfile.dat'
>>> f = file("bigfile.dat", "rb")
>>> f = file("bigfile.dat", "r+b")
(typing f.read() here is a nice way to lock up the machine ;-)
</F>
More information about the Python-list
mailing list