[Scipy-tickets] [SciPy] #568: scipy.io.array_import crashes when first requested line index is too high

SciPy scipy-tickets@scipy....
Tue Dec 18 12:19:50 CST 2007


#568: scipy.io.array_import crashes when first requested line index is too high
---------------------+------------------------------------------------------
 Reporter:  Gellule  |       Owner:  somebody
     Type:  defect   |      Status:  new     
 Priority:  normal   |   Milestone:  0.7     
Component:  Other    |     Version:          
 Severity:  normal   |    Keywords:          
---------------------+------------------------------------------------------
 When reading a large ascii array with array_import and requesting a first
 line through the 'lines' keyword too far inside the file, the import
 routine crashes.

 When array_import opens the ascii_stream, it reads a first chunk of the
 file by calling:
   self._buffer = self.readlines(_READ_BUFFER_SIZE)
 self._buffer contains a number of lines that depends on the actual value
 for _READ_BUFFER_SIZE. If this number of line is lower than the first
 requested line, the call to get_columns() in array_import() fails with the
 following trace:

 Traceback (most recent call last):
 [...]
   File "D:\Python24\Lib\site-packages\scipy\io\array_import.py", line 370,
 in read_array
     colsize, collist = getcolumns(ascii_object, columns, sep)
   File "D:\Python24\Lib\site-packages\scipy\io\array_import.py", line 290,
 in getcolumns
     firstline = stream._buffer[k]
 IndexError: list index out of range

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


More information about the Scipy-tickets mailing list