Am 29.09.2010 11:05, schrieb Tom Potts: > A quick `ls -sl filehole.test' will show that the created file actually > takes up about 980k, rather than the 0 bytes expected. > > If anyone can let me know if this is indeed a bug or feature request, how to > get around it, or where to take it next, I'd really appreciate it.
It's not a bug in Python. You simply misunderstand how sparse files are created. When you write null bytes to a file each null byte takes up space on the file system, too. In order to create a hole, you have to set the file handler's position beyond the file's end. >>> with open("sparse", "w") as fh: ... fh.seek(1000**3) ... fh.write("data") ... $ ls -l --si sparse -rw-r--r-- 1 heimes heimes 1,1G 2010-09-29 22:25 sparse $ ls -s sparse 4 sparse $ du sparse 4 sparse Christian -- http://mail.python.org/mailman/listinfo/python-list