lfs confusion

Andrew Dalke adalke at mindspring.com
Thu Sep 23 19:41:38 CEST 2004


John Hunter wrote:
> I am a bit confused about LFS in python.  In the olden days, I used
> the following to test whether python and my kernel supported large
> files
> 
>     >>> fd = open('/dev/null', 'rw')
>     >>> fd.tell()
>     0L
> 
> If 0L was returned, LFS was enabled, if 0 was returned, LFS was not
> enabled.
   ..
> Is the fd.tell() 0L trick no longer valid.  What is the right way to
> test for LFS support in python?

Python is undergoing a process of int/long unification.
str(long_number) as of 2.0 no longer puts a "L" at the end
of string.

If you want to use your method, try using 'repr' instead
of 'str'.  That probably won't happen for the long term
though (3.0 and greater?).

You might want to try doing a seek to a large int
to see what happens.

lfs_enabled = True
try:
   fd.tell(sys.maxint * 3L)
except OverflowError:
   lfs_enabled = False

I've tried various Python versions I have, but they
are all enabled with large file support so I don't
know if this works.

				Andrew
				dalke at dalkescientific.com



More information about the Python-list mailing list