[New-bugs-announce] [issue4847] csv fails when file is opened in binary mode

jaywalker report at bugs.python.org
Mon Jan 5 18:03:24 CET 2009


New submission from jaywalker <jaywalkie at yahoo.com>:

The following code from the documentation fails:
#################
import csv
reader = csv.reader(open("eggs.csv", "rb"))
for row in reader:
    print(row)
#####################
The output is:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 3, in <module>
_csv.Error: iterator should return strings, not bytes (did you open the
file in text mode?)


It works as expected in python 2.6

----------
components: Library (Lib)
messages: 79165
nosy: jaywalker
severity: normal
status: open
title: csv fails when file is opened in binary mode
versions: Python 3.0

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


More information about the New-bugs-announce mailing list