Showing results for 
Search instead for 
Did you mean: 

Python Node Return Value/Output

Go to solution

How do I specify four inputs to a Python node (call them a, b, c, and d) and return just one value (call it e) which is calculated in Python based on the four inputs, but not a direct terminal pair return value of the four inputs? I tried wiring from the "Return Value" terminal, but this just returns the value of the control wired to the "Return Type" terminal. I have attached a snip from my block diagram for reference. 

0 Kudos
Message 1 of 5

Based on what I understood from your question, exactly how you showed it should be fine for LabVIEW.

Can you post a simplified version of your Python code?


Also, what do you mean by "not a direct terminal pair return value"?


In the last part, you're mentioning it returns the value of the input data type terminal. You got this even when the value was not the "default default value" (i.e. 0 for doubles, false for boolean)?


I also guess you'd have mentioned this if there was an error, but can you confirm you don't see any errors in the indicator you showed?

Message 2 of 5

For some reason everything is working fine now. For a while, I was getting an output equal to the input I had wired into the "Return Type" terminal, but that is no longer the case. For example, I had the ambient pressure of 14.7 as the first input to the Python Node and also had split off from this to wire to the return type terminal. When I ran it, my output was 14.7. Now, I am no longer having that issue so I'm not sure what was going on there. 


What I meant by "not a direct terminal pair return value" was that my output is not just one of the inputs with some math applied to it. For example, my output isn't 2*InputA, but rather a result of the four inputs. 


It had been returning the value of the input data type terminal when I had it configured as the picture attached shows, but now I have it the exact same way and it is working fine. I'm really not sure what was going on here. 


I did not see any errors on the indicator. 


It's a little concerning we can't explain why one minute I had an issue and the next it worked fine, but it works!


Thanks for taking the time to help!

0 Kudos
Message 3 of 5
Accepted by zhale

Well, I'm glad it's working out now. Blindly guessing, I'd say perhaps your Python script was being difficult about something, especially if it's a bit more complicated.


Python can be picky about a whole range of things, or perhaps you had the script open and were making changes but they weren't saved, then you ran LabVIEW's code, and got a wrong answer. When you saved it (or closed it, and it saved, etc) and tried again, it worked.


In any case, hopefully it continues to work as you expect. Good luck (and consider dropping the Dynamic Data Type wires if you can - they almost always seem to be the cause of endless troubles...)

Message 4 of 5

Thanks! I'll try to drop the Dynamic Data Type wires as well. 

0 Kudos
Message 5 of 5