[issue7711] csv error name incorrect

Skip Montanaro report at bugs.python.org
Sat Jan 16 16:36:32 CET 2010


Skip Montanaro <skip at pobox.com> added the comment:

This is to be expected.  The Error Exception is actually defined in the
underlying _csv extension module.  The higher level csv Python module
imports it.  The two are the same object:

>>> import csv, _csv
>>> csv.Error
<class _csv.Error at 0x818517c>
>>> _csv.Error
<class _csv.Error at 0x818517c>
>>> csv.Error is _csv.Error
True

So, continue to use

    try:
       ...
    except csv.Error:
       ...

and ignore the leading underscore.

----------
nosy: +skip.montanaro
resolution:  -> invalid
status: open -> closed

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


More information about the Python-bugs-list mailing list