Error When Using Python Node in LabVIEW With Marshal to Named Tuple

Updated Oct 25, 2023

Reported In

Software

  • LabVIEW

Issue Details

When I wire a cluster to an input of the Python Node in LabVIEW, the node works fine, however, when I try to Marshal to Named Tuple by right-clicking on the wire I get the error:

Polymorphic terminal cannot accept this data type.
 
Python Node wire error.png

Solution

By default, the Python Node marshals clusters to tuples. In Python, you can only reference items in a tuple by index and iterator. Python supports named tuples, which allow you to reference items by name as well.

In order for this to work you need to make sure all the elements of your cluster have a name and that there are no duplicated names in the same hierarchy level of your cluster, otherwise you will run into this issue.

Additional Information

Block Diagram constants have neither a visible label nor a name by default, so it's fairly common to run into this issue when creating constants in LabVIEW and wiring them to the Python Node inputs. If you plan to use constants and Marshal to Named Tuple, right-click your constant and select Visible Items>>Label to add a name to it.

The Python Node feature to marshal clusters to named tuples was added in LabVIEW 2021, so if you don't see this option make sure you are using at least LabVIEW 2021 version.