提交 64c295f9 编写于 作者: W wuzewu

Fix module load bug

上级 bf3b7453
......@@ -70,7 +70,10 @@ class LocalModuleManager(object):
for _item, _cls in inspect.getmembers(
_module, inspect.isclass):
_item = _module.__dict__[_item]
if issubclass(_item, hub.Module):
_file = os.path.realpath(
sys.modules[_item.__module__].__file__)
if issubclass(_item,
hub.Module) and _file == module_file:
version = _item._version
break
sys.path.pop(0)
......
......@@ -183,7 +183,10 @@ class Module(object):
_module = importlib.import_module("{}.module".format(basename))
for _item, _cls in inspect.getmembers(_module, inspect.isclass):
_item = _module.__dict__[_item]
if issubclass(_item, Module):
_file = os.path.realpath(sys.modules[_item.__module__].__file__)
_module_path = os.path.realpath(
os.path.join(directory, "module.py"))
if issubclass(_item, Module) and _file == _module_path:
user_module = _item(directory=directory, **kwargs)
break
sys.path.pop(0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册