[Numpy-discussion] load of custom .npy file fails with numpy 2.0.0

Geoffrey Irving irving@naml...
Thu Aug 2 13:46:43 CDT 2012


Hello,

The attached .npy file was written from custom C++ code.  It loads
fine in Numpy 1.6.2 with Python 2.6 installed through MacPorts, but
fails on a different machine with Numpy 2.0.0 installed via Superpack:

box:array% which python
/usr/bin/python
box:array% which python
box:array% python
Python 2.6.1 (r261:67515, Aug  2 2010, 20:10:18)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.load('blah.npy')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.6/site-packages/numpy-2.0.0.dev_b5cdaee_20110710-py2.6-macosx-10.6-universal.egg/numpy/lib/npyio.py",
line 351, in load
    return format.read_array(fid)
  File "/Library/Python/2.6/site-packages/numpy-2.0.0.dev_b5cdaee_20110710-py2.6-macosx-10.6-universal.egg/numpy/lib/format.py",
line 440, in read_array
    shape, fortran_order, dtype = read_array_header_1_0(fp)
  File "/Library/Python/2.6/site-packages/numpy-2.0.0.dev_b5cdaee_20110710-py2.6-macosx-10.6-universal.egg/numpy/lib/format.py",
line 361, in read_array_header_1_0
    raise ValueError(msg % (d['descr'],))
ValueError: descr is not a valid dtype descriptor: 'd8'
>>> numpy.__version__
'2.0.0.dev-b5cdaee'
>>> numpy.__file__
'/Library/Python/2.6/site-packages/numpy-2.0.0.dev_b5cdaee_20110710-py2.6-macosx-10.6-universal.egg/numpy/__init__.pyc'

It seems Numpy 2.0.0 no longer accepts dtype('d8'):

>>> dtype('d8')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: data type "d8" not understood

Was that intentional?  An API change isn't too much of a problem, but
it's unfortunate if old data files are no longer easily readable.

Thanks,
Geoffrey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: blah.npy
Type: application/octet-stream
Size: 640 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120802/9a5a1c6a/attachment.obj 


More information about the NumPy-Discussion mailing list