[New-bugs-announce] [issue40876] Clarify error message in csv module

Ram Rachum report at bugs.python.org
Fri Jun 5 13:00:03 EDT 2020


New submission from Ram Rachum <ram at rachum.com>:

I was working with the csv module, and I vaguely remembered that you should open files in binary mode. So I did.

Then I saw this error message:

    _csv.Error: iterator should return strings, not bytes (did you open the file in text mode?)

I read the end and thought "I didn't open it in text mode, what does it want from me?!" It took a careful reading to figure out that I was *supposed to* open it in text mode.

I'm going to open a PR to slightly change the text to:

    _csv.Error: iterator should return strings, not bytes (the file should be opened in text mode)

----------
components: Library (Lib)
messages: 370769
nosy: cool-RR
priority: normal
severity: normal
status: open
title: Clarify error message in csv module
type: behavior
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40876>
_______________________________________


More information about the New-bugs-announce mailing list