[Numpy-discussion] npz load on numpy 3

josef.pktd at gmail.com josef.pktd at gmail.com
Tue Mar 29 04:16:00 EDT 2011

more python 3.2 fun

a npz file saved with python 2.6 (I guess) that I try to read with python 3.2

I have no clue, since I never use .npz files

>>> arr = np.load(r"..\scikits\statsmodels\tsa\vector_ar\tests\results\vars_results.npz")
>>> arr
<numpy.lib.npyio.NpzFile object at 0x0000000003874AC8>
>>> dir(arr)
['__class__', '__contains__', '__del__', '__delattr__', '__dict__',
'__doc__', '__eq__', '__format__', '__ge__', '__getattribute__',
'__getitem__', '__gt__', '__hash__', '__init__', '__iter__', '__le__',
'__lt__', '__module__', '__ne__', '__new__', '__reduce__',
'__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__',
'__subclasshook__', '__weakref__', '_files', 'close', 'f', 'fid',
'files', 'items', 'iteritems', 'iterkeys', 'keys', 'zip']
>>> arr.keys()
['causality', 'orthirf', 'detomega', 'nirfs', 'loglike', 'stderr',
'crit', 'phis', 'nahead',
'totobs', 'type', 'obs', 'irf', 'coefs']
>>> arr['irf']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Programs\Python32\lib\site-packages\numpy\lib\npyio.py",
line 222, in __getitem__
    return format.read_array(value)
  File "C:\Programs\Python32\lib\site-packages\numpy\lib\format.py",
line 449, in read_array
    array = pickle.load(fp)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf0 in position
6: ordinal not in range(128)

Any ideas ?


More information about the NumPy-Discussion mailing list