[SciPy-user] loadmat: TypeError Array can not be safely cast to required type

Simon Burton simon at arrowtheory.com
Tue Apr 5 19:12:59 CDT 2005


Hi,

I am having the same problem as mentioned here:
http://www.scipy.net/pipermail/scipy-user/2004-December/003910.html

Attached is a small example V6 .mat file that demonstrates the problem (scipy 0.3.2).
A collegue says it works on his (older) scipy. I couldn't find where
to download the old versions of scipy.

thanks,

Simon.

Python 2.3.3 (#1, Dec 16 2004, 12:18:55)
[GCC 3.3.3 (Debian)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy.io.mio as sp
>>> sp.loadmat('x') # version 4 files work OK
{'x': array([ 1.])}
>>> sp.loadmat('x') # version 6 file
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/home/groups/SML/lib/python2.3/site-packages/scipy/io/mio.py", line 692, in loadmat
    thisdict = _loadv5(fid,basename)
  File "/home/groups/SML/lib/python2.3/site-packages/scipy/io/mio.py", line 631, in _loadv5
    el, varname = _get_element(fid)
  File "/home/groups/SML/lib/python2.3/site-packages/scipy/io/mio.py", line 619, in _get_element
    el, name = _parse_mimatrix(fid,numbytes)
  File "/home/groups/SML/lib/python2.3/site-packages/scipy/io/mio.py", line 510, in _parse_mimatrix
    result = squeeze(transpose(reshape(result,dims[::-1])))
TypeError: Array can not be safely cast to required type
>>>


-- 
Simon Burton, B.Sc.
Licensed PO Box 8066
ANU Canberra 2601
Australia
Ph. 61 02 6249 6940
http://arrowtheory.com 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x.mat
Type: application/octet-stream
Size: 184 bytes
Desc: not available
Url : http://www.scipy.net/pipermail/scipy-user/attachments/20050406/fa7be129/x.obj


More information about the SciPy-user mailing list