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 skip.montanaro
Recipients baloan, eric.araujo, skip.montanaro, zacktu
Date 2010-07-29.11:10:27
SpamBayes Score 1.0590227e-05
Marked as misclassified No
Message-id <19537.24977.664894.186812@montanaro.dyndns.org>
In-reply-to <1280319275.88.0.402604272656.issue7198@psf.upfronthosting.co.za>
Content
> If the documentation is not clear enough about requiring binary, it is
    > a doc bug.

The documentation for both csv.reader and csv.writer state (this is from the
Python 2.7 version):

    If *csvfile* is a file object, it must be opened with the 'b' flag on
    platforms where that makes a difference.

I suppose we could be explicit and mention Windows here, but the wording is
quite clear.  There is really no harm in always opening the file in binary
mode, and I do that myself even though I only program on Unix or Mac
platforms where it's safe to open the file in text mode.

This all changed in Python 3.  There, the choice of line ending is up to the
programmer, so file objects for use by the csv module are opened with
newline='' and when writing CSV data the writer object takes complete
control of proper line termination according to the programmer's stated
choice of lineterminator.

Skip
History
Date User Action Args
2010-07-29 11:10:57skip.montanarosetrecipients: + skip.montanaro, baloan, eric.araujo, zacktu
2010-07-29 11:10:30skip.montanarolinkissue7198 messages
2010-07-29 11:10:29skip.montanarocreate