[Scipy-tickets] [SciPy] #563: windows: read_array only works with filename string

SciPy scipy-tickets@scipy....
Sat Dec 15 07:31:28 CST 2007

#563: windows: read_array only works with filename string
 Reporter:  m100      |       Owner:  somebody
     Type:  defect    |      Status:  new     
 Priority:  normal    |   Milestone:  0.7     
Component:  scipy.io  |     Version:          
 Severity:  normal    |    Keywords:          
 def get_open_file(fileobject, mode='rb'):
         # this is the duck typing check: if fileobject
         # can be used is os.path.expanduser, it is a string
         # otherwise it is a fileobject
         fileobject = os.path.expanduser(fileobject)

 os.path.expanduser should raise a AttributeError exception, so

 file = fileobject

 but with Windows, os.path.expanduser doesn't raise that exception, so it
 fails at

 ntpath.py line 350
 def expanduser(path):
     """Expand ~ and ~user constructs.

     If user or $HOME is unknown, do nothing."""
     if path[:1] != '~':

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

More information about the Scipy-tickets mailing list