[SciPy-User] scipy.io.loadmat error when trying to read a .mat file

Dharhas Pothina Dharhas.Pothina@twdb.state.tx...
Mon Oct 4 08:30:14 CDT 2010


Hi,

I'm using scipy 0.8.0 and having problems using the loadmat function. I've looked through the forum and found a few posts that seem related separately to this warning and error but not the solution. Any help is appreciated.

I'm receiving the following warning when importing scipy.io

In [4]: import scipy.io
C:\Python26\lib\site-packages\scipy\io\matlab\mio5.py:90: RuntimeWarning: __builtin__.file size changed, may indicate binary incompatibility from mio5_utils import VarReader5

And then the following error when trying to read a .mat file

In [5]: a = scipy.io.loadmat('20100819102442.mat')
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

C:\Documents and Settings\dpothina\My Documents\Projects\InstreamFlows\M9\<ipython console> in <modu
le>()

C:\Python26\lib\site-packages\scipy\io\matlab\mio.pyc in loadmat(file_name, mdict, appendmat, **kwar
gs)
    138     '''
    139     MR = mat_reader_factory(file_name, appendmat, **kwargs)
--> 140     matfile_dict = MR.get_variables()
    141     if mdict is not None:
    142         mdict.update(matfile_dict)

C:\Python26\lib\site-packages\scipy\io\matlab\mio5.pyc in get_variables(self, variable_names)
    416                 continue
    417             try:
--> 418                 res = self.read_var_array(hdr, process)
    419             except MatReadError, err:
    420                 warnings.warn(

C:\Python26\lib\site-packages\scipy\io\matlab\mio5.pyc in read_var_array(self, header, process)
    385            `process`.
    386         '''
--> 387         return self._matrix_reader.array_from_header(header, process)
    388
    389     def get_variables(self, variable_names=None):

C:\Python26\lib\site-packages\scipy\io\matlab\mio5_utils.pyd in scipy.io.matlab.mio5_utils.VarReader
5.array_from_header (scipy\io\matlab\mio5_utils.c:4821)()

C:\Python26\lib\site-packages\scipy\io\matlab\mio5_utils.pyd in scipy.io.matlab.mio5_utils.VarReader
5.array_from_header (scipy\io\matlab\mio5_utils.c:4491)()

C:\Python26\lib\site-packages\scipy\io\matlab\mio5_utils.pyd in scipy.io.matlab.mio5_utils.VarReader
5.read_struct (scipy\io\matlab\mio5_utils.c:6713)()

C:\Python26\lib\site-packages\scipy\io\matlab\mio5_utils.pyd in scipy.io.matlab.mio5_utils.VarReader
5.read_mi_matrix (scipy\io\matlab\mio5_utils.c:4079)()

C:\Python26\lib\site-packages\scipy\io\matlab\mio5_utils.pyd in scipy.io.matlab.mio5_utils.VarReader
5.array_from_header (scipy\io\matlab\mio5_utils.c:4491)()

C:\Python26\lib\site-packages\scipy\io\matlab\mio5_utils.pyd in scipy.io.matlab.mio5_utils.VarReader
5.read_struct (scipy\io\matlab\mio5_utils.c:6713)()

C:\Python26\lib\site-packages\scipy\io\matlab\mio5_utils.pyd in scipy.io.matlab.mio5_utils.VarReader
5.read_mi_matrix (scipy\io\matlab\mio5_utils.c:4079)()

C:\Python26\lib\site-packages\scipy\io\matlab\mio5_utils.pyd in scipy.io.matlab.mio5_utils.VarReader
5.array_from_header (scipy\io\matlab\mio5_utils.c:4406)()

C:\Python26\lib\site-packages\scipy\io\matlab\mio5_utils.pyd in scipy.io.matlab.mio5_utils.VarReader
5.read_char (scipy\io\matlab\mio5_utils.c:5555)()

TypeError: buffer is too small for requested array


thanks

- dharhas



More information about the SciPy-User mailing list