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

R David Murray report at bugs.python.org
Thu Apr 2 20:41:48 CEST 2009


R David Murray <rdmurray at bitdance.com> added the comment:

On Thu, 2 Apr 2009 at 17:55, Skip Montanaro wrote:
> This thread is getting a bit long.  Can someone summarize how the expected
> usage of the csv module is supposed to change?  If I read things correctly,
> instead of requiring (in the general case) that csv files be opened in
> binary mode, the requirement will be that they be opened with newline=''.
> This will thwart any attempts by the io module at newline translation, but
> since the file is still opened in text mode its contents will implicitly be
> Unicode (or Unicode translated to bytes with a specific encoding).  That
> encoding will also be specified in the call to open().

I believe that is an accurate summary.

> Is this about correct?  Do any test cases need to be updated or added?  I
> notice that something called BytesIO is imported from io but not used.  Were
> some test cases removed which used to involve that class or is that a 2to3
> artifact?

I will look in to this, and add an encoding example to the docs as you
suggest in another email.

--David

----------
nosy: +r.david.murray-old

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


More information about the Python-bugs-list mailing list