Martin Panter added the comment: 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)) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue14285> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com