This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author datapythonista
Recipients SilentGhost, datapythonista, mrabarnett, serhiy.storchaka
Date 2016-11-09.09:11:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I could research a bit more on the problem. This is a minimal code that reproduces what happened:

    from io import StringIO
    import csv

    csv_file = StringIO('''1\t"A

    reader = csv.reader(csv_file, delimiter='\t')
    for i, row in enumerate(reader):

    print(reader.line_num)  # 2
    print(i + 1)            # 1

The reason to return the right number of rows with the default delimiter, is because the quote needs to be immediately after the delimiter to be considered the opening of a quoted text.

If the file contains an opening quote, and the EOF is reached without its closing quote, the reader considers all the text until EOF to be that field.

This would work as expected in a line like:

    1,"well quoted text","this one has a missing quote

But it'd fail silently with unexpected results in all other cases. I'd expect csv to raise an exception, more than the current behavior.

Do you agree? Should I create another issue to address this?
Date User Action Args
2016-11-09 09:11:41datapythonistasetrecipients: + datapythonista, mrabarnett, SilentGhost, serhiy.storchaka
2016-11-09 09:11:41datapythonistasetmessageid: <>
2016-11-09 09:11:41datapythonistalinkissue28642 messages
2016-11-09 09:11:40datapythonistacreate