This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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:13martin.pantersetrecipients: + martin.panter, ncoghlan, eric.araujo, BreamoreBoy, python-dev, schlamar, eric.snow, robagar
2015-12-05 00:13:13martin.pantersetmessageid: <1449274393.6.0.679613335272.issue14285@psf.upfronthosting.co.za>
2015-12-05 00:13:13martin.panterlinkissue14285 messages
2015-12-05 00:13:13martin.pantercreate