[Numpy-discussion] Question about improving genfromtxt errors

Pierre GM pgmdevlist@gmail....
Fri Sep 25 14:39:56 CDT 2009

On Sep 25, 2009, at 3:12 PM, Christopher Barker wrote:

> Pierre GM wrote:
>> That way, we don't slow
>> things down when everything works, but just add some delay when they
>> don't.
> good goal, but if you don't keep track of where you are, wouldn't you
> need to re-parse the whole file to figure it out again?

Indeed. But does it really matter ? We're in a case where there's a  
problem already...

> Maybe a "debug" mode that the user could turn on and off would fit  
> the need.

Not a bad idea. Another option would be to give the user the  
possibility to skip the offending lines:
* we already know what number of columns to expect (nbcols)
* we check whether the current row has the correct nb of columns
* if it doesn't match, we skip or raise an exception with the  
corresponding line number. But even if we skip, we need to log the the  
line number to tell the user that there was a problem (issuing a  
warning ?)


More information about the NumPy-Discussion mailing list