Message196126
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) |
|
Date |
User |
Action |
Args |
2013-08-25 12:56:23 | Thibault.Kruse | set | recipients:
+ Thibault.Kruse |
2013-08-25 12:56:23 | Thibault.Kruse | set | messageid: <1377435383.74.0.241640816854.issue18829@psf.upfronthosting.co.za> |
2013-08-25 12:56:23 | Thibault.Kruse | link | issue18829 messages |
2013-08-25 12:56:23 | Thibault.Kruse | create | |
|