|On this page|
For example, you might take a reference to a node:
>>> node = hou.node("/obj/geo1/sphere1")
If that node is later deleted, and then you try to use your reference to the deleted node, Houdini will raise this error:
>>> path = node.path() hou.ObjectWasDeleted: ...
Tips and tricks
There is no way to check if a reference is still valid, other than to try an operation and catch this error.
If you want to keep a long-ish term reference to a node, you might find it more convenient to instead keep a reference to the node’s unique integer ID for the node in this session (hou.Node.sessionId). Then, when you want to use the node again, call hou.nodeFromSessionId with the ID. It will return a reference to the node, or
Noneif the node has since been deleted.
Methods from hou.Error
Return a description of the class of exception. The description is not related to the exception instance.
Return the name of the exception type. Instances of different
subclasses of hou.Error will return different names. Instances of the
base class will return
You can also use
str(e.__class__) to get the name of the subclass.
Return a message specific to the exception instance.