fix ModuleManager.find_module() - don't set path
until it's actually found
This commit is contained in:
parent
671e259ada
commit
a3bde5e682
1 changed files with 6 additions and 7 deletions
|
@ -159,16 +159,15 @@ class ModuleManager(object):
|
||||||
paths = self._module_paths(name)
|
paths = self._module_paths(name)
|
||||||
|
|
||||||
path = None
|
path = None
|
||||||
for path in paths:
|
for possible_path in paths:
|
||||||
if os.path.isdir(path):
|
if os.path.isdir(possible_path):
|
||||||
type = ModuleType.DIRECTORY
|
type = ModuleType.DIRECTORY
|
||||||
path = os.path.join(path, "__init__.py")
|
possible_path = os.path.join(possible_path, "__init__.py")
|
||||||
else:
|
else:
|
||||||
possible_path = "%s.py" % path
|
possible_path = "%s.py" % possible_path
|
||||||
if os.path.isfile(possible_path):
|
|
||||||
path = possible_path
|
|
||||||
|
|
||||||
if path:
|
if os.path.isfile(possible_path):
|
||||||
|
path = possible_path
|
||||||
break
|
break
|
||||||
|
|
||||||
if not path:
|
if not path:
|
||||||
|
|
Loading…
Reference in a new issue