Commit c6456d1f authored by Lucas Bourneuf's avatar Lucas Bourneuf

savage fix for non-importable python scripts

parent 899821ea
......@@ -120,11 +120,20 @@ def topological_sort_by_io(inputs:dict, outputs:dict) -> iter:
def build_python_script_from_name(module_name) -> Script:
path = module_name.replace('/', '.')
import_as_module = True
try:
module = importlib.import_module(path)
except TypeError:
import_as_module = False
if import_as_module:
# Reload needed because the module itself is
# modified by build_script_from_module
module = importlib.reload(module)
return build_script_from_module(module)
else: # just load it savagely
# module_name is not importable directly
return build_script_from_json({'python file': module_name + '.py'})
def build_asp_script_from_name(fname:str) -> str:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment