Message255907
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)) |
|
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 | |
|