Windows/numpy1.0.4 memmap & astype produce loads of warnings on delete

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Windows/numpy1.0.4 memmap & astype produce loads of warnings on delete

Wim Bakker-3
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
disappears.

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?

Regards,

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.
_______________________________________________
Numpy-discussion mailing list
[hidden email]
http://projects.scipy.org/mailman/listinfo/numpy-discussion
Reply | Threaded
Open this post in threaded view
|

Re: Windows/numpy1.0.4 memmap & astype produce loads of warnings on delete

Robert Kern-2
On Thu, Apr 17, 2008 at 3:10 AM, Wim Bakker <[hidden email]> wrote:

> 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
>  disappears.
>
>  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?

I think I or someone else fixed most of these issues in SVN. Can you
try out SVN numpy and see if the warnings are gone in your code? I
don't see them on OS X.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco
_______________________________________________
Numpy-discussion mailing list
[hidden email]
http://projects.scipy.org/mailman/listinfo/numpy-discussion
Reply | Threaded
Open this post in threaded view
|

Re: Windows/numpy1.0.4 memmap & astype produce loads of warnings on delete

Wim Bakker-3
In reply to this post by Wim Bakker-3
Robert,

I've replaced my C:\Python24\Lib\site-packages\numpy\core\memmap.py
with the one from  http://svn.scipy.org/svn/numpy/trunk/numpy/core/
and that fixes the problem.

Thanks for your quick help!

When is the new version of numpy due?

Wim Bakker

Any garbage below this line is not mine.
--
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.
_______________________________________________
Numpy-discussion mailing list
[hidden email]
http://projects.scipy.org/mailman/listinfo/numpy-discussion
Reply | Threaded
Open this post in threaded view
|

Re: Windows/numpy1.0.4 memmap & astype produce loads of warnings on delete

Robert Kern-2
On Thu, Apr 17, 2008 at 4:22 AM, Wim Bakker <[hidden email]> wrote:
> Robert,
>
>  I've replaced my C:\Python24\Lib\site-packages\numpy\core\memmap.py
>  with the one from  http://svn.scipy.org/svn/numpy/trunk/numpy/core/
>  and that fixes the problem.
>
>  Thanks for your quick help!
>
>  When is the new version of numpy due?

Not too long from now. A couple weeks if not sooner.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco
_______________________________________________
Numpy-discussion mailing list
[hidden email]
http://projects.scipy.org/mailman/listinfo/numpy-discussion