[Scipy-tickets] [SciPy] #1566: scipy.io.savemat cannot use the OrderedDict collection to make a struct

SciPy Trac scipy-tickets@scipy....
Tue Nov 29 01:38:06 CST 2011


#1566: scipy.io.savemat cannot use the OrderedDict collection to make a struct
-------------------------+--------------------------------------------------
 Reporter:  ali-ebrahim  |       Owner:  somebody    
     Type:  enhancement  |      Status:  needs_review
 Priority:  normal       |   Milestone:  Unscheduled 
Component:  scipy.io     |     Version:  0.9.0       
 Keywords:               |  
-------------------------+--------------------------------------------------
Changes (by ali-ebrahim):

  * status:  new => needs_review


Comment:

 It appears that the root cause of this issue is that an OrderedDict has a
 __dict__ attribute, while a regular Dict does not. The way the
 to_writeable function (in io/matlab/mio5.py) detects type is by detecting
 the keys attribute, but not a __dict__ attribute.

 One way to fix this problem is to change line 442 in io/matlab/mio5.py
 from

 {{{
 if hasattr(source, '__dict__'):
 }}}
 to
 {{{
 if hasattr(source, '__dict__') and not hasattr(source, 'keys'):
 }}}

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1566#comment:1>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list