Message255907
| Author | martin.panter |
|---|---|
| Recipients | BreamoreBoy, eric.araujo, eric.snow, martin.panter, ncoghlan, python-dev, robagar, schlamar |
| Date | 2015-12-05.00:13:13 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1449274393.6.0.679613335272.issue14285@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
I think the problem with doing a blind import of the parent package is it would be hard to differentiate between the ImportError when the package (or an ancestor) is missing, versus a user-generated ImportError. Maybe you could inspect the exception as a workaround (untested):
try:
__import__(pkg_name)
except ImportError as err:
if err.name != pkg_name and not pkg_name.startswith(err.name + "."):
raise
raise error(format(err)) |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2015-12-05 00:13:13 | martin.panter | set | recipients: + martin.panter, ncoghlan, eric.araujo, BreamoreBoy, python-dev, schlamar, eric.snow, robagar |
| 2015-12-05 00:13:13 | martin.panter | set | messageid: <1449274393.6.0.679613335272.issue14285@psf.upfronthosting.co.za> |
| 2015-12-05 00:13:13 | martin.panter | link | issue14285 messages |
| 2015-12-05 00:13:13 | martin.panter | create | |