[Numpy-discussion] Windows/numpy1.0.4 memmap & astype produce loads of warnings on delete

Wim Bakker bakker@itc...
Thu Apr 17 03:10:51 CDT 2008

The last version of numpy gives me headaches. I've been able to trace
the problem to the use of astype(). When a memmap is deleted I get the
following warning:

Exception exceptions.ValueError: 'mmap closed or invalid' in <bound
method memmap.__del__ of memmap([ 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,
8.,  9.])> ignored

The memmap still seems to work but these error messages slow don't the
processing considerably. When reverting back to numpy 1.0.2 the problem

Below is a short program that reproduces the warnings:

import numpy

a = numpy.memmap(r'C:\Temp\test.dat', mode='w+', shape=(10,), dtype='b')

for i in range(10):
    a[i] = i

del a

a = numpy.memmap(r'C:\Temp\test.dat', mode='r', shape=(10,), dtype='b')

a = a.astype('d')

del a

The last delete produces the warnings.

Am I doing something wrong or should this be fixed in numpy?


Wim Bakker
International Institute for Geo-Information Science and Earth Observation (ITC)
Chamber of Commerce: 410 27 560

E-mail disclaimer
The information in this e-mail, including any attachments, is intended for the addressee only. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or action in relation to the content of this information is strictly prohibited. If you have received this e-mail by mistake, please delete the message and any attachment and inform the sender by return e-mail. ITC accepts no liability for any error or omission in the message content or for damage of any kind that may arise as a result of e-mail transmission.

More information about the Numpy-discussion mailing list