[issue4847] csv fails when file is opened in binary mode

Antoine Pitrou report at bugs.python.org
Mon Mar 9 12:40:14 CET 2009


Antoine Pitrou <pitrou at free.fr> added the comment:

> I had already read it. I gave it a prize for "least intuitive arg in the
> language".

Please open a bug, then :)

> So you plan to use that, reading "lines" instead of blocks?
> You'll still have to examine which CRs and LFs are embedded and which
> are line terminators. You might just as well use f.read(BLOCKSZ) and
> avoid having to insist that the user explicitly write ", newline=''".

Sorry, but who is "you" in that paragraph?
The csv module currently accepts any iterator yielding lines of text,
not only file objects. Changing this would be a major compatibility
break.

> Excel has no default, because the user has no option -- the defined
> encoding is "cp" + str(codepage_number_derived_from_locale), e.g.
> "cp1252".

Then Excel-generated CSV files all use different encodings? Gasp :-(

----------
message_count: 14.0 -> 15.0

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4847>
_______________________________________


More information about the Python-bugs-list mailing list