sascha herfort


About Me



Recent Forum Posts

Python in HDA - how to NodeError without bringing up console? May 17, 2019, 3:13 p.m.

Yes I got NodeErrors just fine, when using a python inside the HDA, but then it fails to pass through its incoming geo on the first cook.
Also my python code modifies nodes upstream, so this may cause a recook loop.

When I tried having the python sop outside of the HDA's main graph and have it be a message node, the errors would only show up as warnings on the HDA.
Also force cooking the python sop with a callback brings up the console again.

I finally used an error sop with references to invisible parameters on the HDA, but that feels like it can't be the ‘official’ way.

Python in HDA - how to NodeError without bringing up console? May 17, 2019, 2:42 p.m.

Here's an example.

Is this case it only brings up the python console with the error and doesn't even show it on the node.

I understand that the error printed, is because the callback failed, but how else to run code from the python module, if not through a callback from a parm?

Python in HDA - how to NodeError without bringing up console? May 17, 2019, 10:03 a.m.

Hey guys!

I'm building a HDA that uses python code and I can't figure out how to make the HDA node error in a houdini-esque fashion.
i.e. the HDA's file parm pointing to an unreadable file.
Whenever I manage to make it error, the python console appears, making it look to the user, like the code crashed.

These are the things I've tried:

1. Python node inside the HDA's graph, connected to its output node:
Errors get propagated properly, but on the first cook, the python node does not pass through its incoming geometry.
Also this setup can lead to unwanted recooks, when the python node changes nodes upstream.

2. Python node inside the HDA, but not part of its graph. The python node is one of the HDA's message nodes, to propagate its error upwards and is force cooked through callbacks from the HDA's parms:
The propagated errors appears as warnings on the HDA node and the python console comes up, stating that the node being ‘callbacked’ has errored.

3. Python module raising NodeError:
The HDA errors as expected, but also the python console appears, making it look like the HDA crashed, rather than a user error.

4. Python node or Python module driving an “error” node inside the HDA's graph.
As soon as the HDA is locked, attempting to change the error through python results in a permission error.
Making the “error” node editable, would allow user interference.

I will try adding invisible parms to the HDA, driving those through python and referencing them from the error node, but this feels like an elaborate and dirty workaround.

There surely must be a way to make an HDA node error without raising the console, but how?