[issue15767] add ModuleNotFoundError

Chris Jerdonek report at bugs.python.org
Mon Feb 18 21:10:46 CET 2013


Chris Jerdonek added the comment:

>> from foo import bar
>> Here bar can be not module, but an attribute of foo (for example, os.path).
> Serhiy: What exception is raised in that situation is controlled by the eval loop, not importlib so that would be a separate change.

Just to clarify from this exchange, is there a chance we will use this same exception type (perhaps in a later change) in cases where bar is not found?  If so, I think it's worth considering something like "NotFoundImportError" or "ImportNotFoundError" that doesn't single out module.  Importing classes, etc. is quite a common pattern (e.g. examples appear in PEP 8).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15767>
_______________________________________


More information about the Python-bugs-list mailing list