[New-bugs-announce] [issue11356] Include module name on ImportError

Nick Coghlan report at bugs.python.org
Mon Feb 28 23:30:45 CET 2011

New submission from Nick Coghlan <ncoghlan at gmail.com>:

Catching ImportError in order to switch to an alternate implementation can mask real failures in imported modules. Attaching the module name as an attribute would allow this to be handled correctly by doing something like:

 import simplejson
except ImportError as err:
 if err.module_name != 'simplejson':
 <backup plan>

See http://mail.python.org/pipermail/python-ideas/2011-February/009209.html

components: Interpreter Core
messages: 129729
nosy: ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Include module name on ImportError
type: feature request
versions: Python 3.3

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list