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 lregebro
Recipients lregebro
Date 2011-01-20.10:32:25
SpamBayes Score 2.8639186e-05
Marked as misclassified No
Message-id <1295519548.77.0.698015070506.issue10954@psf.upfronthosting.co.za>
In-reply-to
Content
In Python 2 the file used for csv.writer() should be opened in binary mode, while in Python 3 is should be opened in text mode but with newlines set to ''.

This change is neither warned for by python -3, nor is there a fixer for it (and making a fixer would be tricky), thus it provides a surprising API change.

I think that csv.writer() should warn or even fail if the file is opened in binary mode under Python 3. Failing is a god option, as a binary file is likely to be a port from Python 2, and you are likely to get the less useful message "must be bytes or buffer, not str". Even if you understand that message, you will then probably just change the file mode from binary to text, but you will not add the lineendings='' parameter, and thusly you might cause subtle error on windows.
History
Date User Action Args
2011-01-20 10:32:28lregebrosetrecipients: + lregebro
2011-01-20 10:32:28lregebrosetmessageid: <1295519548.77.0.698015070506.issue10954@psf.upfronthosting.co.za>
2011-01-20 10:32:25lregebrolinkissue10954 messages
2011-01-20 10:32:25lregebrocreate