Skip to content

[Bug] Input node value containing "." is incorrectly treated as module.function #176

@Max-ChenFei

Description

@Max-ChenFei

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions