Hi, when I use following code to run a workflow
from python_workflow_definition.pyiron_base import load_workflow_json
delayed_object_lst = load_workflow_json(file_name='workflow.json')
delayed_object_lst[-1].pull()
For example, the workflow file may contain nodes like this:
[
{"id": 0, "type": "function", "value": "workflow.preprocess"},
{"id": 1, "type": "input", "value": "image.png", "name": "input_image"}
]
The value of the nodes are splited by ".", and treat first element as the module
|
if isinstance(v, str) and "." in v: |
|
p, m = v.rsplit(".", 1) |
|
if p == "python_workflow_definition.shared": |
|
p = "python_workflow_definition.pyiron_base" |
|
mod = import_module(p) |
but for input nodes, the value can be a file name, such as "image.png". Because "image.png" contains ., it is interpreted as a Python module path. As a result, the code tries to import image, which raises an error at
Hi, when I use following code to run a workflow
For example, the workflow file may contain nodes like this:
[ {"id": 0, "type": "function", "value": "workflow.preprocess"}, {"id": 1, "type": "input", "value": "image.png", "name": "input_image"} ]The value of the nodes are splited by ".", and treat first element as the module
python-workflow-definition/src/python_workflow_definition/pyiron_base.py
Lines 244 to 248 in 4538453
but for input nodes, the value can be a file name, such as "image.png". Because "image.png" contains ., it is interpreted as a Python module path. As a result, the code tries to import image, which raises an error at
python-workflow-definition/src/python_workflow_definition/pyiron_base.py
Line 248 in 4538453