Shell Rop Exception Handling

   2520   3   1
User Avatar
Member
380 posts
Joined: 7月 2005
Offline
Hi there, wondering if its possible to trap an exception
from a shell rop and have the node color itself, and/or
query some error state, or further raise a more informative
Error. Ultimately, it would be great to be able to identify
where certain shell rops in a rop otl failed.. but heres a
simplified example…

In the Scripts Tab of a Shell Rop ive entered:
print “PRE RENDER”; raise Exception(“WTF”)
and set the script type to python.

when invoke a render on the node I get:
-> render -v /out/shell1
Rendering shell1
Render failed:

n = hou.node('/out/shell1')
>>> n.render()
PRE-RENDER
Traceback (most recent call last):
File “<console>”, line 1, in <module>
File “/home/prisms/builder-new/Nightly10.0/dev/hfs/houdini/scripts/python/hou.py”, line 19337, in render
return _hou.RopNode_render(*args, **kwargs)
OperationFailed: The attempted operation failed.

I would have expected the node to have flagged itself
in an red/lined error state much like other rop nodes
that fail. Nothing particular to the exception is printed,
so im wondering how it gets handled, if i can somehow
get more detailed information about a script that failed
in a shell rop, and and how to setup an otl to handle
render failures from internal shell rops that fail. Can
hou.Error() somehow be employed?
User Avatar
Member
380 posts
Joined: 7月 2005
Offline
Hmm, i truly hope there is a better alternative, but this
is kind of a neat hacky workaround i just discovered.

The attached otl raises an exception on even frames,
and does nothing on odd frames. A post render script
calls out to a PythonModule definition that raises the
exception. Once the exception has been raised, and
you pick the otl instance
, you get the red striped
failure lines and the Exception traceback is appended
to the error field of the operator info (MMB). The gui
is not updated until the node is actually picked and
it doesnt look like updateui does anything in H10.

-> fcur 2
-> render -v /out/test_Exception1
Rendering test_Exception1
Render failed:
Error: Python error: Traceback (most recent call last):
File “<stdin>”, line 1, in <module>
File “opdefDriver/test_Exception?PythonModule”, line 4, in raiseError
Exception: WTF
-> opset -p on /out/test_Exception1

Subsequently changing to an odd frame and rendering so
that no exception is raised, however, no amount of picking
on or off gets rid of the red lined error, nor does the previous
error message get cleared from the opinfo. updateui does
nothing either. however i was able to force the node to clear
its error display and message with an ottouch.

-> fcur 1
-> render -v /out/test_Exception1
Rendering test_Exception1
-> ottouch Driver/test_Exception test_Exception.otl


bugginess or partial implemention?

Attachments:
test_Exception.otl (6.5 KB)

User Avatar
Member
380 posts
Joined: 7月 2005
Offline
Interesting that if all i do is move the python code from
the post-render script field to the to the pre-render script
field, none of the above applies.

-> fcur 2
/ -> render -v /out/test_Exception1
Rendering test_Exception1
Render failed:
/ -> opset -p on /out/test_Exception1
User Avatar
Member
380 posts
Joined: 7月 2005
Offline
i would assume that re-rendering then node would
also reset the error coloration should the render not
subsequently bomb out with any errors on the node.
This does not appear to be the case. How can
the red/render error striping be removed?


otsync -u path/to/node
otsync path/to/node

prior to every render?
will this work if the node is read only?
any hom methods?
anybody?
  • Quick Links