Author jesstess
Recipients docs@python, georg.brandl, jesstess, r.david.murray, sfinnie, terry.reedy
Date 2014-04-20.01:42:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1397958122.62.0.20409058935.issue8387@psf.upfronthosting.co.za>
In-reply-to
Content
I ran some experiments to see what the state of the world is. I generated a test.csv by exporting a CSV file from Numbers on OSX. This generated a file with Windows-style \r\n-terminated lines. The attached test_csv.py tries to open this CSV file in binary and universal newlines modes. Here's what happens on various platforms

Python 3:
* Linux: both binary and universal work
* OSX: binary errors out, universal works
* Windows: binary errors out, universal works

In both cases, the error was:

$ python3 test_csv.py
Traceback (most recent call last):
  File "test_csv.py", line 5, in <module>
    for row in spamreader:
_csv.Error: iterator should return strings, not bytes (did you open the file in text mode?)

Python 2:
* Linux: both binary and universal work
* OSX: both binary and universal
* Windows: wasn't readily able to test

If I manually create a CSV file using TextEdit in plaintext mode on OSX, that produces a file with Mac-style \r-terminated lines. test_csv.py has the same results on this file on OSX (errors out in binary mode in Python 3).
History
Date User Action Args
2014-04-20 01:42:02jesstesssetrecipients: + jesstess, georg.brandl, terry.reedy, r.david.murray, sfinnie, docs@python
2014-04-20 01:42:02jesstesssetmessageid: <1397958122.62.0.20409058935.issue8387@psf.upfronthosting.co.za>
2014-04-20 01:42:02jesstesslinkissue8387 messages
2014-04-20 01:42:01jesstesscreate