[EMAIL PROTECTED] wrote] > > Hi, > > Is there any special support for sparse file handling in python? My > initial search didn't bring up much (not a thorough search). I wrote > the following pice of code: > > options.size = 6442450944 > options.ranges = ["4096,1024","30000,314572800"] > fd = open("testfile", "w") > fd.seek(options.size-1) > fd.write("a") > for drange in options.ranges: > off = int(drange.split(",")[0]) > len = int(drange.split(",")[1]) > print "off =", off, " len =", len > fd.seek(off) > for x in range(len): > fd.write("a") > > fd.close() > > This piece of code takes very long time and in fact I had to kill it as > the linux system started doing lot of swapping. Am I doing something > wrong here? Is there a better way to create/modify sparse files?
test_largefile.py in the Python test suite does this kind of thing and doesn't take very long for me to run on Linux (SuSE 9.0 box). Trent -- Trent Mick [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list