[Scipy-tickets] [SciPy] #274: io.read_array fails when fileobject is a unicode string

SciPy scipy-tickets at scipy.net
Mon Oct 2 09:32:06 CDT 2006


#274: io.read_array fails when fileobject is a unicode string
----------------------+-----------------------------------------------------
 Reporter:  ggellner  |       Owner:  somebody
     Type:  defect    |      Status:  new     
 Priority:  normal    |   Milestone:          
Component:  Other     |     Version:          
 Severity:  normal    |    Keywords:          
----------------------+-----------------------------------------------------
 Due to the type checking in get_open_file if the user passes a unicode
 string, which is a valid input for the open function, the read_array will
 fail as it trys to use the unicode string as if it was a file object.

 I have included a patch that changes the type checking into a duck typing
 check: if the fileobject variable can be used as an argument for
 os.path.expanduser it will open a new file, otherwise it assumes the
 fileobject is a python file object.

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


More information about the Scipy-tickets mailing list