[Scipy-tickets] [SciPy] #512: Regression in scipy.io.read_array introduced in 0.6.0

SciPy scipy-tickets@scipy....
Tue Oct 9 18:56:02 CDT 2007


#512: Regression in scipy.io.read_array introduced in 0.6.0
----------------------+-----------------------------------------------------
 Reporter:  srooks    |       Owner:  somebody
     Type:  defect    |      Status:  new     
 Priority:  normal    |   Milestone:  0.7     
Component:  scipy.io  |     Version:          
 Severity:  normal    |    Keywords:          
----------------------+-----------------------------------------------------
 Hi, first of all many thanks for scipy, I do enjoy it.

 I have just updated to scipy.0.6.0 and found what I believe is a
 regression.
 The following code use to work:

 {{{
 #!python
 import cStringIO

 import numpy as nx

 from scipy.io import read_array

 mem_file= cStringIO.StringIO()
 mem_file.writelines("100, 110, 120, 130, 140")
 mem_file.seek(0) # back at the beginning

 try:
     rawdata= read_array(mem_file,
                 separator= ',',
                 columns= ((0,5),))
 finally:
     mem_file.close()

 print rawdata
 }}}

 And now I have the following exception:

 {{{
 Traceback (most recent call last):
   File "scipy_io_bug.py", line 16, in <module>
     columns= ((0,5),))
   File "C:\Python25\Lib\site-packages\scipy\io\array_import.py", line 364,
 in re
 ad_array
     ascii_object = ascii_stream(fileobject, lines=lines, comment=comment,
 linese
 p=linesep)
   File "C:\Python25\Lib\site-packages\scipy\io\array_import.py", line 141,
 in __
 init__
     self.file = get_open_file(fileobject, mode='r')
   File "C:\Python25\Lib\site-packages\scipy\io\array_import.py", line 97,
 in get
 _open_file
     fileobject = os.path.expanduser(fileobject)
   File "C:\Python25\lib\ntpath.py", line 350, in expanduser
     if path[:1] != '~':
 TypeError: 'cStringIO.StringO' object is unsubscriptable
 Exception exceptions.AttributeError: "'ascii_stream' object has no
 attribute 'fi
 le'" in <bound method ascii_stream.__del__ of
 <scipy.io.array_import.ascii_strea
 m object at 0x0156BEF0>> ignored
 }}}

 I believe that was introduced by revision changeset:2480 to close
 ticket:274.

 When reverted the above test works fine.

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


More information about the Scipy-tickets mailing list