How to scan for cook errors after a hou.ui.triggerUpdate()

   1060   1   0
User Avatar
Member
4 posts
Joined: Dec. 2022
Offline
I have a setup where I can cook specic nodes, via python, using displayflags and hou.ui.triggerUpdate().
Now one of the sub node has python error (function X not defined) so the cook stops right there.

How can I get the error of that node, in my script after the call to hou.ui.triggerUpdate() ?

I do this to scan ALL nodes for error, but they all report nothing, even tough I see one of them with a python error (red triangle) :

def CheckForErrors(node):
    def PrintResult(node):
        if len(node.errors()) != 0 or len(node.warnings()) != 0 or len(node.messages()) != 0:
            print("State %-34s t=%-40s e=%s w=%s m=%s"%(str(node), node.type().nameWithCategory(), str(node.errors()), str(node.warnings()),str(node.messages())  ))
    PrintResult(node)
    for n in node.children():
        CheckForErrors(n)
        PrintResult(n)

cook_done = asyncio.Event()
cook_done_lambda = lambda: cook_done.set()
hou.ui.addTriggerUpdateCallback(cook_done_lambda)
hou.ui.triggerUpdate()
await cook_done.wait()
hou.ui.removeTriggerUpdateCallback(cook_done_lambda)

CheckForErrors(hou.node("/"))

#CheckForErrors reports nothing even tough one node is in error state after the cook.

Tnx
Edited by fveilleux - Feb. 24, 2023 10:47:32
User Avatar
Member
4 posts
Joined: Dec. 2022
Offline
I found the problem.
Houdini was actually not done when I traversed the network.
using executeDeferred made it properly detect/show erros.

hdefereval.executeDeferred(CheckForErrors, hou.node("/")) 
  • Quick Links