mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-10 22:36:55 +08:00
fix picker error on importlib loaded module
This commit is contained in:
@@ -179,7 +179,7 @@ def get_module_by_module_path(module_path: Union[str, ModuleType]):
|
|||||||
module = module_path
|
module = module_path
|
||||||
else:
|
else:
|
||||||
if module_path.endswith(".py"):
|
if module_path.endswith(".py"):
|
||||||
module_name = "dummy"
|
module_name = re.sub("^[^a-zA-Z_]+", "", re.sub("[^0-9a-zA-Z_]", "", module_path[:-3].replace("/", "_")))
|
||||||
module_spec = importlib.util.spec_from_file_location(module_name, module_path)
|
module_spec = importlib.util.spec_from_file_location(module_name, module_path)
|
||||||
module = importlib.util.module_from_spec(module_spec)
|
module = importlib.util.module_from_spec(module_spec)
|
||||||
sys.modules[module_name] = module
|
sys.modules[module_name] = module
|
||||||
|
|||||||
Reference in New Issue
Block a user