elecstorm Posted September 21, 2015 Share Posted September 21, 2015 (edited) Hi! Is there a way to catch Mantra error in python script? I want to implement something like this: hou.hipFile.load(hipPath) try: hou.node("/out/mantra").render((1, 1, 1)) except error: #launch manta again or something else... hou.hipFile.clear() print "Frame " + str(1) + " was rendered" Edited September 21, 2015 by elecstorm Quote Link to comment Share on other sites More sharing options...
elecstorm Posted September 21, 2015 Author Share Posted September 21, 2015 (edited) Ok, I found this way: try: hou.node("/out/mantra1").render((1,1,1)) except hou.Error, ex: print ex.instanceMessage() It works in the python shell, I have not tested it with the hython. But I don't understand this exception (I found it somewhere): except hou.Error, ex "hou.Error, ex" - It's not definition (because of comma). So, what is it? Edited September 21, 2015 by elecstorm Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted September 21, 2015 Share Posted September 21, 2015 Comma is old way of storing info returned from exception as variable that you can access. Use 'as' instead of comma for future proof way. 1 Quote Link to comment Share on other sites More sharing options...
elecstorm Posted September 22, 2015 Author Share Posted September 22, 2015 Comma is old way of storing info returned from exception as variable that you can access. Use 'as' instead of comma for future proof way. Ok, thank you! I checked script with hython - it works. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.