Message23295
On trying to parse a '\r' terminated csv generated on a
Mac, I get a "newline inside string" error from the csv
module.
Two things sprung to mind having read:
http://cvs.sourceforge.net/viewcvs.py/python/python/dist/src/Modules/_csv.c?rev=1.15&view=markup
...for a bit.
1. The Dialect's lineterminator doesn't appear to be
used when parsing a CSV. This feels like a bug to be,
'cos I could specify the terminator if
Reader_iternext(ReaderObj *self) used it :-S
2. The processing in Reader_iternext(ReaderObj *self)
assumes that a '\r' will be followed by '\0' for Macs,
'\n' for windows, and anything else is an error.
but:
>>> c = open('var\\data\\metadata.csv').read()
>>> c[:100]
'BENEFIT,,Subjects relating to all benefits,AB
\rBENEFIT,PARTNERDIED,Bereavement
Should I be expecting to see a '\0' there?
Anyway, the real bug seems to be the reader's ignorance
of the lineterminator. However, even if my analysis is
off the mark, the problem still exists :-S
cheers,
Chris |
|
Date |
User |
Action |
Args |
2007-08-23 14:27:47 | admin | link | issue1072404 messages |
2007-08-23 14:27:47 | admin | create | |
|