HOM Python scripting errors

Where to find error messages

  • For the shelf/tab menu: in the details section of the popup window.

  • For HDA callbacks: in the console.

  • For 123.py/456.py: in the console.

  • For parameters: on node.

  • For Python-based nodes: on node.

Interpreting Python error messages

When Python code generates an unhandled exception, it will display a traceback of the call stack where the exception was raised. By looking at the last entry in the traceback, you can find the line of code that raised the exception.

For example, if there was spelling error in the implementation of fixFilePrefixes, you might see the following traceback.

>>> hou.session.fixFilePrefix(hou.node('/'), '/home/luke/project', '$HIP')
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "hou.session", line 12, in fixFilePrefix
NameError: global name 'to_prefix' is not defined

The last line of the traceback displays the string representation of the exception. The most common exceptions the hou module is likely to raise are hou.OperationFailed, hou.PermissionError, hou.LoadWarning, and hou.ObjectWasDeleted. A list of all exception types defined in the hou module can be found in the reference documentation.

Tip

The Python source editor, multi-line expression editor, shelf script editor, and HDA script editors show the line number in the bottom-right corner, helping to locate the line that raised an exception.