[SciPy-user] mio5 works?

Neal Becker ndbecker2 at gmail.com
Fri Feb 15 11:21:26 EST 2008


Neal Becker wrote:

> I noticed this message:
> http://permalink.gmane.org/gmane.comp.python.scientific.devel/6850
> 
> 
> A = ones((10,20,30))
> f = open('test.mat','wb')
> MW =
> scipy.io.mio5.MatFile5Writer(f,do_compression=True,unicode_strings=True)
> MW.put_variables({'A1':A,'A2':A+1j*A,'s1':'string1','s2':u'string2'})
> f.close()
> 
> When I try this, I get this error:
> /usr/tmp/python-AjDvrb.py in <module>()
>       5 f = open('test.mat','wb')
>       6 MW =
>       scipy.io.mio5.MatFile5Writer(f,do_compression=True,unicode_strings=True)
> ----> 7
> MW.put_variables({'A1':A,'A2':A+1j*A,'s1':'string1','s2':u'string2'})
>       8 f.close()
>       9 ## data = cPickle.load (open ('fade_plots', 'r'))
> 
> /usr/lib64/python2.5/site-packages/scipy/io/mio5.py in put_variables(self,
> mdict)
>     735         for name, var in mdict.items():
>     736             is_global = name in self.global_vars
> --> 737             self.writer_getter.rewind()
>     738             self.writer_getter.matrix_writer_factory(
>     739                 var,
> 
> /usr/lib64/python2.5/site-packages/scipy/io/mio5.py in rewind(self)
>     638
>     639     def rewind(self):
> --> 640         self.stream.seek(0)
>     641
>     642     def matrix_writer_factory(self, arr, name, is_global=False):
> 
> AttributeError: 'builtin_function_or_method' object has no attribute
> 'seek'

A bit more info:

ipdb> self.stream
<built-in function StringIO>
ipdb> self.stream.seek
*** AttributeError: 'builtin_function_or_method' object has no attribute 'seek'







More information about the SciPy-User mailing list