Suggestions for workaround in CSV bug

Michael Ströder michael at stroeder.com
Tue Jan 24 09:32:14 CET 2006


Simmons, Stephen wrote:
> 
> I've come across a bug in CSV where the csv.reader() raises an 
> exception if the input line contains '\r'. Example code and output
> below shows a test case where csv.reader() cannot read an array
> written by csv.writer(). 
> 
> Error: newline inside string
> WARNING: Failure executing file: <csv_error.py>

Did you play with the csv.Dialect setting lineterminator='\n' ?

csv.reader(file(name, 'rb'),lineterminator='\n)

See also: http://docs.python.org/lib/csv-fmt-params.html

Ciao, Michael.



More information about the Python-list mailing list