Catching maya's error ?

31 views
Skip to first unread message

Virbhadra Gupta

unread,
Aug 1, 2018, 4:19:12 PM8/1/18
to Python Programming for Autodesk Maya
hello,
i have a code where i am using try and except

ex:

try:
    do_something()
except:
    cmds.warning("some error")

function may give some error ex: "pCube03 not found", "can't constraint pCube02"
how can we catch that error message and use that in except as warning.

Marcus Ottosson

unread,
Aug 1, 2018, 4:24:35 PM8/1/18
to python_in...@googlegroups.com
try:
    do_something()
except Exception as e:
    cmds.warning(e)

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/96dd4b77-890d-4a5c-b3a9-0c1ffa70614f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Virbhadra Gupta

unread,
Aug 1, 2018, 4:29:02 PM8/1/18
to Python Programming for Autodesk Maya
Really that much simple.
Thanks!!!
Reply all
Reply to author
Forward
0 new messages