[issue18829] csv produces confusing error message when passed a non-string delimiter

Vajrasky Kok report at bugs.python.org
Sun Sep 8 17:10:16 CEST 2013


Vajrasky Kok added the comment:

David R. Murray said, '"delimiter must be a 1 character string" would cover it.'

You mean

$ ./python -c 'import csv; reader = csv.reader("foo", delimiter="")' 

should give this error '"delimiter" must be a 1 character string'?

Attached the patch to accommodate your request.

I found out that:

$ ./python -c 'import csv; reader = csv.reader("foo", quotechar="")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: quotechar must be set if quoting enabled

This is not consistent with the cure. But since this ticket is about delimiter, we keep the status-quo about quotechar for now. After the patch is committed, we can open the ticket about the quotechar inconsistency.

The fix for this quotechar is not straightforward, though, because of the quoting condition.

----------
Added file: http://bugs.python.org/file31667/fix_error_message_reader_csv_alternative_1_v8.patch

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


More information about the Python-bugs-list mailing list