H16.0.736 Windows7
I have a 123.py file that imports another module. In that module, I have some code that is suppose to set the viewport to look out a specific camera. The code looks something like this:
import toolutils
defCam = hou.node(“/obj/defCam”)
scene_view = toolutils.sceneViewer()
viewport = scene_view.curViewport()
viewport.setCamera(defCam)* assume defCam has been already been setup
If I run this snippet from Python shell inside Houdini there is no issue. However, when it runs during initial launch of Houdini (double click on desktop icon), I get the following error:
Error running Python code:
Traceback (most recent call last):
File “C:<hidden_path>/Documents/houdini16.0/scripts/123.py”, line 20, in <module>
import startup
File “<hidden_path>/houdini/scripts/python\startup.py”, line 27, in <module>
scene_view = toolutils.sceneViewer()
File “CPROGRA~1/SIDEEF~1/HOUDIN~1.736/houdini/python2.7libs\toolutils.py”, line 73, in sceneViewer
primarypane = hou.ui.paneTabOfType(hou.paneTabType.SceneViewer, index)
File “CPROGRA~1/SIDEEF~1/HOUDIN~1.736/houdini/python2.7libs\hou.py”, line 46554, in paneTabOfType
return _hou.ui_paneTabOfType(*args)
NotAvailable: Not available in this context.
No desktops are availableAny idea why it runs fine when inside Houdini but fails during startup? Is there a better way to achieve this? TIA