Jessica McKellar added the comment: 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). ---------- nosy: +jesstess Added file: http://bugs.python.org/file34981/test_csv.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8387> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com