Tim Peters wrote: >> Traceback (most recent call last): >> File "<pyshell#1>", line 1, in -toplevel- >> f = file('veryBigFile.dat','r+') >> IOError: [Errno 2] No such file or directory: 'veryBigFile.dat' >> >> Is it a BUG or a FEATURE? > > 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).
however, if you use the C level API, you get EINVAL (which presumably means that the CRT cannot open this file in text mode), not ENOENT. this is also true for older versions of Python: Python 2.1.1 (#20, Aug 23 2001, 11:27:17) [MSC 32 bit (Intel)] on win32 >>> f = open("bigfile.dat") >>> f = open("bigfile.dat", "r+") Traceback (most recent call last): File "<stdin>", line 1, in ? IOError: [Errno 22] Invalid argument: 'bigfile.dat' which probably means that this fix http://www.python.org/sf/538827 is partially responsible for the misleading error message. (the cause of this seems to be that when you open a text file for updating, the CRT check if there's a chr(26) at the end of the file, but the 32-bit lseek API doesn't support seeking to positions larger than 2^31-2) </F> -- http://mail.python.org/mailman/listinfo/python-list