Title: Include module name on ImportError
Type: enhancement Stage: needs patch
Components: Interpreter Core Versions: Python 3.3
Status: closed Resolution: duplicate
Dependencies: Superseder: ImportError needs attributes for module and file name
View: 1559549
Assigned To: Nosy List: cool-RR, georg.brandl, ncoghlan
Priority: normal Keywords:

Created on 2011-02-28 22:30 by ncoghlan, last changed 2011-03-01 06:35 by georg.brandl. This issue is now closed.

Messages (2)
msg129729 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2011-02-28 22:30
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>

msg129741 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2011-03-01 06:35
This is a dupe of #1559549.
Date User Action Args
2011-03-01 06:35:45georg.brandlsetstatus: open -> closed

nosy: + georg.brandl
messages: + msg129741

superseder: ImportError needs attributes for module and file name
resolution: duplicate
2011-02-28 22:52:29cool-RRsetnosy: + cool-RR
2011-02-28 22:30:43ncoghlancreate