This question might not be specific to PDG/TOPs, but it is where the question is originating for me.
I love that raising an exception in a Python node will show a big ol' red exclamation icon next to the node and display the error message when inspecting the Work Item Info.
Is there a way to trigger a warning from within a Python node instead? I hope to get the same behaviour as the Error SOP when severity is set to Warning instead of Error.
I've found hou.NodeWarning, but it still shows as a full error instead of just a Warning. Calling warnings.warn also does not work, from my testing.
Node warning in Python processor
1529 2 1- MatFacer
- Member
- 4 posts
- Joined: April 2014
- Offline
- tpetrick
- Staff
- 585 posts
- Joined: May 2014
- Offline
From a Python Processor or a Python Script TOP, you can use the pdg.Node.cookWarning(..) method to add a non-fatal warning to the node. That'll show up as a yellow exclamation mark: https://www.sidefx.com/docs/houdini/tops/pdg/Node.html#cookWarning [www.sidefx.com]
In both of those nodes, that method can be called on the self variable available in the Python code, e.g. self.cookWarning("Missing input files").
In both of those nodes, that method can be called on the self variable available in the Python code, e.g. self.cookWarning("Missing input files").
Edited by tpetrick - Feb. 17, 2022 17:55:39
- MatFacer
- Member
- 4 posts
- Joined: April 2014
- Offline
-
- Quick Links