10-03-2018 09:07 AM
Hi,
I have a question!
I'm trying to send cluster data from LabVIEW to python through python node, but so far I have no clue how LabVIEW send cluster data to python (I mean in what format or form), have tried many python parsing options but still getting an error (end of topic), any ideas of how to parse cluster LabVIEW data in python!?
simple LabVIEW vi and python script would be really appreciated!
LabVIEW: (Hex 0x687) There was an error in executing the specified function. Python returned the following error: <class 'TypeError'> bad argument type for built-in operation
10-04-2018 09:04 AM - edited 10-04-2018 09:16 AM
LabVIEW clusters can be sent to Python... but it looks like we forgot to include a shipping example for that. We will fix that mistake in the next version. In the meantime, here's the script to catch a cluster:
def SumClusterIntegers(cluster):
"cluster[0] -> Integer, cluster[1] -> String, cluster[2] -> Integer"
return cluster[0] + cluster[2]
And here's the VI:
Attached are the script and the VI. I hope that helps.
10-04-2018 09:20 AM
There is one shipping example that uses clusters, but it doesn't explicitly call out that it does. It is here:
examples\Connectivity\Python\PythonNode_ComputeEuclideanDistance.vi
We still should add an explicitly tagged example for this common operation.
10-04-2018 10:14 AM - edited 10-04-2018 10:40 AM
it's really helpful thanks a lot!
but not quite what I meant, I want is the return value to be a cluster!
like in the picture I uploaded in cluster x2 (numeric3 would be 10 and string would be abc)
10-05-2018 02:01 AM
01-27-2020 11:03 AM
Hey ramymagdy,
Were you ever able to get this to work? I am also working have a cluster output from the Python node, but running into the same error (1671) you show here. I have a work around of calling separate functions for each, but this isn't as efficient as I'd like.
Thanks,
RG