Jump to content

Python Node doesn't tolerate warnings (LabVIEW 2021 SP1)


Recommended Posts

Take an Open Python Session Node, pass an error cluster with a non-zero error code (but otherwise status = FALSE and empty Source string), connect the outputs to a Python Node (and use a Close Python Session node if you want afterwards).


The Open Session Node transmits the warning (so doesn't generate an error) but the following Python Node converts the warning into an error (same code, TRUE status and source = Python Node in Calling VI name).

That is unexpected.


Link to comment
1 hour ago, Phillip Brooks said:

I agree. The Python Node seems to promote the 'warning code' to an 'error code', even after executing the Python function name successfully. 🤔

Thanks for clarifying that. I forgot to mention that this "feature" has indeed nothing to do with what happens in the Python function itself (which could be a simple return() statement). And that I tested this in LV 2021 SP1.

I haven't tested this with the Matlab node (which is way worse than the Python node, as it loses connection with the Matlab instance as soon as an error is thrown, requiring the process to be killed in the Windows Task Manager, while at least in the Python node, you get the Python error code and message as part of the error cluster and - generally, but not always - can recover from this and reuse the Python session refnum).

Let's say I wouldn't be shocked if the same feature existed.

This being said, the workaround is straightforward: store the error in before calling the node, and if it is a warning, pass a no error to the node, and merge the error cluster output of the node with the stored error in before continuing.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.