[Numpy-discussion] scipy.io.loadmat incompatible with Numpy 1.0.2

Ryan May rmay at ou.edu
Mon Apr 9 12:03:59 EDT 2007


Hi,

As far as I can tell, the new Numpy 1.0.2 broke scipy.io.loadmat. 
Here's what I get when I try to open a file with using loadmat with 
numpy 1.0.2 (on gentoo AMD64):

In [2]: loadmat('tep_iqdata.mat')
---------------------------------------------------------------------------
exceptions.AttributeError                            Traceback (most 
recent call last)

/usr/lib64/python2.4/site-packages/scipy/io/mio.py in loadmat(file_name, 
mdict, appendmat, basename, **kwargs)
      94     '''
      95     MR = mat_reader_factory(file_name, appendmat, **kwargs)
---> 96     matfile_dict = MR.get_variables()
      97     if mdict is not None:
      98         mdict.update(matfile_dict)

/usr/lib64/python2.4/site-packages/scipy/io/miobase.py in 
get_variables(self, variable_names)
     267             variable_names = [variable_names]
     268         self.mat_stream.seek(0)
--> 269         mdict = self.file_header()
     270         mdict['__globals__'] = []
     271         while not self.end_of_stream():

/usr/lib64/python2.4/site-packages/scipy/io/mio5.py in file_header(self)
     508         hdict = {}
     509         hdr = self.read_dtype(self.dtypes['file_header'])
--> 510         hdict['__header__'] = hdr['description'].strip(' \t\n\000')
     511         v_major = hdr['version'] >> 8
     512         v_minor = hdr['version'] & 0xFF

AttributeError: 'numpy.ndarray' object has no attribute 'strip'


Reverting to numpy 1.0.1 works fine for the same code.  So the question 
is, does scipy need an update, or did something unintended creep into 
Numpy 1.0.2? (Hence the cross-post)

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma





More information about the NumPy-Discussion mailing list