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 sjmachin
Recipients baloan, eric.araujo, sjmachin, skip.montanaro, zacktu
Date 2010-12-26.20:52:49
SpamBayes Score 1.8392382e-05
Marked as misclassified No
Message-id <1293396771.67.0.157981030344.issue7198@psf.upfronthosting.co.za>
In-reply-to
Content
Skip, I'm WRITING, not reading.. Please read the 3.1 documentation for csv.writer. It does NOT mention newline='', and neither does the example. Please fix.

Other problems with the examples: (1) They encourage a bad habit (open inside the call to reader/writer); good practice is to retain the reference to the file handle (preferably with a "with" statement) so that it can be closed properly. (2) delimiter=' ' is very unrealistic.

The documentation for both 2.x and 3.x should be much more explicit about what is needed in open() for csv to work properly and portably:

2.x read: use mode='rb' -- otherwise fail on Windows
2.x write: use mode='wb' -- otherwise fail on Windows
3.x read: use newline='' -- otherwise fail unconditionally(?)
3.x write: use newline='' -- otherwise fail on Windows

The 2.7 documentation says """If csvfile is a file object, it must be opened with the 'b' flag on platforms where that makes a difference""" ... in my experience, people are left asking "what platforms? what difference?"; Windows should be mentioned explicitly.
History
Date User Action Args
2010-12-26 20:52:51sjmachinsetrecipients: + sjmachin, skip.montanaro, baloan, eric.araujo, zacktu
2010-12-26 20:52:51sjmachinsetmessageid: <1293396771.67.0.157981030344.issue7198@psf.upfronthosting.co.za>
2010-12-26 20:52:49sjmachinlinkissue7198 messages
2010-12-26 20:52:49sjmachincreate