This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Thibault.Kruse
Recipients Thibault.Kruse
Date 2013-08-25.12:56:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1377435383.74.0.241640816854.issue18829@psf.upfronthosting.co.za>
In-reply-to
Content
To reproduce

$ python --version
Python 2.7.3
$ python -c 'from __future__ import unicode_literals; import csv; reader = csv.reader("foo", delimiter=",")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: "delimiter" must be an 1-character string

This is confusing because "," is like a 1-character (unicode) string, while csv requires a 1-character (byte) string. In python3, it's the inverse problem, using bytestring b','

$ python3 --version
Python 3.2.3
$ python3 -c 'import csv; reader = csv.reader("foo", delimiter=b",")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: "delimiter" must be an 1-character string


So I believe csv should state more clearly what went wrong here in each case, or what kind of string csv is willing to accept in the respective python version.

Whether the python3 refusal to use a bytestring is even reasonable I don't know.

This might or might not be related to the issue of multichar delimiters: http://bugs.python.org/issue15158  (just sayin)
History
Date User Action Args
2013-08-25 12:56:23Thibault.Krusesetrecipients: + Thibault.Kruse
2013-08-25 12:56:23Thibault.Krusesetmessageid: <1377435383.74.0.241640816854.issue18829@psf.upfronthosting.co.za>
2013-08-25 12:56:23Thibault.Kruselinkissue18829 messages
2013-08-25 12:56:23Thibault.Krusecreate