#14798: pyclbr now raises ImportError instead of KeyError for missing packages

This commit is contained in:
Petri Lehtinen 2012-05-18 21:51:11 +03:00
commit 43ae3ceab8
4 changed files with 12 additions and 0 deletions

View file

@ -130,6 +130,8 @@ def _readmodule(module, path, inpackage=None):
parent = _readmodule(package, path, inpackage)
if inpackage is not None:
package = "%s.%s" % (inpackage, package)
if not '__path__' in parent:
raise ImportError('No package named {}'.format(package))
return _readmodule(submodule, parent['__path__'], package)
# Search the path for the module