[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:

try:
 import simplejson
except ImportError as err:
 if err.module_name != 'simplejson':
   raise
 <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>
<http://bugs.python.org/issue11356>
_______________________________________


More information about the Python-bugs-list mailing list