[SciPy-user] scipy.io.read_array exception on Windows (bug?)

Marek Wojciechowski mwojc@p.lodz...
Fri Apr 11 15:56:51 CDT 2008


On Windows, Python 2.5 and scipy-0.6.0 when i call
    data = read_array( file, **kwargs )
and file argument is the fileobject the following exception occurs:

Traceback (most recent call last):
  File "C:\Python25\Lib\site-packages\ffnet\ffnet.py", line 851, in readdata
    data = read_array( file, **kwargs )
  File "C:\Python25\Lib\site-packages\scipy\io\array_import.py", line 364, in 
    ascii_object = ascii_stream(fileobject, lines=lines, comment=comment, 
  File "C:\Python25\Lib\site-packages\scipy\io\array_import.py", line 141, in 
    self.file = get_open_file(fileobject, mode='r')
  File "C:\Python25\Lib\site-packages\scipy\io\array_import.py", line 97, in 
    fileobject = os.path.expanduser(fileobject)
  File "C:\Python25\lib\ntpath.py", line 350, in expanduser
    if path[:1] != '~':
TypeError: 'file' object is unsubscriptable

However if i use a filename string as the argument everything works fine. Is 
this a known problem? I suppose both fileobject and filename arguments should 
work (as for example on my Linux, Python 2.4 and scipy-0.6.0)

Marek Wojciechowski

More information about the SciPy-user mailing list