[SciPy-dev] getting scipy.io.mio / numpyio working again

Andrew Straw strawman at astraw.com
Thu Dec 15 16:22:22 CST 2005


Hi,

I'm trying to get the following working:

import scipy

a={'a':scipy.arange(10)}
scipy.io.mio.savemat('test.mat',a)
b = scipy.io.mio.loadmat('test.mat')
print b


If I apply the following patch:

Index: mio.py
===================================================================
--- mio.py      (revision 1485)
+++ mio.py      (working copy)
@@ -870,7 +870,7 @@

         imagf = var.dtypechar in ['F', 'D']
         fid.fwrite([var.shape[1], var.shape[0], imagf, 
len(variable)+1],'int')
-        fid.fwrite(variable+'\x00','char')
+        fid.fwrite(variable+'\x00','uchar')
         if imagf:
             fid.fwrite(var.real)
             fid.fwrite(var.imag)

I can get as far as the following traceback.  I don't have time right 
now to delve deeper.

Traceback (most recent call last):
  File "numpyiotest.py", line 4, in ?
    scipy.io.mio.savemat('test.mat',a)
  File "/usr/lib/python2.3/site-packages/scipy/io/mio.py", line 873, in 
savemat
    fid.fwrite(variable+'\x00','uchar')
  File "/usr/lib/python2.3/site-packages/scipy/io/mio.py", line 221, in 
write
    numpyio.fwrite(self,count,data,mtype,bs)
numpyio.error: Does not support extended types.




More information about the Scipy-dev mailing list