File size error in os.stat with large files.
John Hunter
jdhunter at nitace.bsd.uchicago.edu
Tue Jul 9 15:43:43 EDT 2002
>>>>> "Joe" == Joe Woodward <joe.woodward at padtinc.com> writes:
Joe> I have a 4.2GB file that os.stat is reporting to be
Joe> 164MB. Smaller files seem to work just fine, but I have not
Joe> played with it to find out where the cut-off point is.
You have to compile python with large file support to handle files
over 2GB. To test whether you have this enabled:
>>> fd = open('somefile.dat', 'rw')
>>> fd.tell()
0L
If it returns '0', LFS is not enabled. if it returns '0L', LFS is enabled.
If not, you'll need to rebuild python for LFS (or try and find a
precompiled binary). I've done the build for linux and not widows, so
you'll need to adapt them to your environment/compiler. On linux, to
compile python with LFS, unpack the source distribution and run
./configure. Then edit the Makefile and set the OPTs to be:
OPT= -ggdb -O2 -Wall -Wstrict-prototypes -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
and 'make install'. Try the 'tell' test again and you should get '0L'.
Good luck,
John Hunter
More information about the Python-list
mailing list