Re: [Python-Dev] CSV, bytes and encodings

2009-04-01 Thread R. David Murray
On Thu, 2 Apr 2009 at 07:23, Antoine Pitrou wrote: Le mercredi 01 avril 2009 ?? 18:22 -0400, R. David Murray a ??crit : I just added some tests to trunk that seem to indicate this case is handled correctly in terms of preserving the data. Maybe you didn't write the file such that the fields wit

Re: [Python-Dev] CSV, bytes and encodings

2009-04-01 Thread Antoine Pitrou
Le mercredi 01 avril 2009 à 18:22 -0400, R. David Murray a écrit : > I just added some tests to trunk that seem to indicate this case is > handled correctly in terms of preserving the data. Maybe you didn't > write the file such that the fields with the newlines were quoted? I used the default cs

Re: [Python-Dev] CSV, bytes and encodings

2009-04-01 Thread Aahz
On Wed, Apr 01, 2009, s...@pobox.com wrote: > > Antoine> Perhaps. But without using 'rU' the file couldn't be read at > Antoine> all. (I'm not sure it was Windows line endings by the way; > Antoine> perhaps Macintosh ones; anyway, it didn't work using 'rb') > > Please file a bug repo

Re: [Python-Dev] CSV, bytes and encodings

2009-04-01 Thread R. David Murray
OK, Antoine, having merged my newline tests to py3k and having them work when lineend is set to '', as you suggested on the ticket, I'm inclined to agree with you that this is a doc bug. Skip? --David ___ Python-Dev mailing list Python-Dev@python.org h

Re: [Python-Dev] CSV, bytes and encodings

2009-04-01 Thread R. David Murray
On Wed, 1 Apr 2009 at 10:53, Antoine Pitrou wrote: Perhaps. But without using 'rU' the file couldn't be read at all. (I'm not sure it was Windows line endings by the way; perhaps Macintosh ones; anyway, it didn't work using 'rb') I just tested it in 2.6. It must have been old-mac (\r), which i

Re: [Python-Dev] CSV, bytes and encodings

2009-04-01 Thread R. David Murray
On Wed, 1 Apr 2009 at 05:37, s...@pobox.com wrote: This case arises rarely, but it does turn up every now and again. If you For some definition of "rarely". I don't handle CVS files generated by Windows very often, but I've run into it a least a couple times. That says to me that it isn't al

Re: [Python-Dev] CSV, bytes and encodings

2009-04-01 Thread skip
Antoine> Perhaps. But without using 'rU' the file couldn't be read at Antoine> all. (I'm not sure it was Windows line endings by the way; Antoine> perhaps Macintosh ones; anyway, it didn't work using 'rb') Please file a bug report and assign to me. Does it work in 2.x? What was the

Re: [Python-Dev] CSV, bytes and encodings

2009-04-01 Thread Antoine Pitrou
pobox.com> writes: > > Antoine> The documentation is, IMO, wrong even in 2.x. Just yesterday I > Antoine> had to open a CSV file in 'rU' mode because it had Windows line > Antoine> endings and I'm under Linux > > See above. You almost certainly didn't have fields containing CRLF

Re: [Python-Dev] CSV, bytes and encodings

2009-04-01 Thread skip
>> Having read through the ticket, it seems that a CSV file must be (and >> 2.6 was) treated as a binary file, and part of the CSV module's job >> is to convert that binary data to and from strings. Antoine> IMO this interpretation is flawed. In 2.6 there is no tangible Antoi

[Python-Dev] CSV, bytes and encodings

2009-04-01 Thread Antoine Pitrou
R. David Murray bitdance.com> writes: > > Having read through the ticket, it seems that a CSV file must be (and > 2.6 was) treated as a binary file, and part of the CSV module's job > is to convert that binary data to and from strings. IMO this interpretation is flawed. In 2.6 there is no tangib