Hi. I have been experimenting with mmap recently. I determined how to read and write properly from it and so search and replace on large files. The problem I am having is with replaces that are larger than the mmap. In this instance I need to

* rewind
* resize the mmap to accomodate the text
* move some part of the text to a new location on the mmap so the new text does not overwrite the old
* write the replacement text

When I try to use resize it gives me the following error;

SystemError: mmap: resizing not available--no mremap()

I pass size to mmap to begin with based on  my filesize

size = os.path.getsize(filename)

m = mmap.mmap(f.fileno(), size)

I am attempting to give it new size by doing:

m.resize(size + size_diff)

size_diff is difference between original and what will be new file size after the insertion.

Can someone provide some hint on resizing or its this a python bug? Many thanks

Regards
David


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to