This class is mostly an implementation detail of how Houdini replaces Python’s standard streams with versions that allow Python input and output in Houdini windows and pane tabs.
The methods that might be useful outside of internal SideFX scripts are addCloseCallback(), removeCloseCallback(), and callbacks(). These let you register functions that Houdini calls when the Python shell window or pane tab is closed (the equivalent of atexit()
scripts in regular Python).
The other methods should be considered internal implementation details, and you should not use them.
Methods ¶
addDataForReading(data)
addEOFForReading()
addCloseCallback(callback)
Register a Python callback to be called whenever the last Houdini Python Shell is closed.
The argument is a callable object that expects no parameters.
def cleanup(): # Here is where you would run your cleanup code when # the Python shell has closed. pass hou.ui.shellIO().addCloseCallback(cleanup)
You might use this function to cleanly terminate any mechanisms that are dependent on the Python shell. For example, you can register a callback which disables an object from logging output messages to the shell.
closeCallbacks()
→ tuple
of callback
Return a tuple of all the Python callbacks that have been registered with hou.ShellIO.addCloseCallback.
getAndClearWrittenData()
→ string
interruptShellThread()
isatty()
→ bool
Implemented as part of the “file-like object” interface.
isWaitingForCommand()
→ bool
readline(size=-1)
→ string
Implemented as part of the “file-like object” interface.
removeCloseCallback(callback)
Remove a Python callback that was previously registered with hou.ShellIO.addCloseCallback. See hou.ShellIO.addCloseCallback for more information.
Raises hou.OperationFailed if the callback was not previously registered.
setIsWaitingForCommand(on)
write(data)
Implemented as part of the “file-like object” interface.