def _find_module_path(module_name, mod_path=None):
"""Recursively find the module path. ImportError will
be raised if the module cannot be found.
"""
parts = module_name.split(".")
find_args = [parts[0]]
if mod_path is not None:
find_args.append([mod_path])
file_,mod_path,desc = imp.find_module(*find_args)
if len(parts) > 1:
return _find_module_path(".".join(parts[1:]), mod_path)
return mod_path
评论列表
文章目录