You can use try/except statements to catch Maya errors. For example:

cmds.select(cl=True)
try:
    cmds.extrude()
except Exception, e:
    print "There was an error and it said", e

I don't know of any way to tell if a warning is raised, only that you can catch 
(suppress) them using mel.eval('catchQuiet(command)').

On Wednesday, March 13, 2013 9:56:24 AM UTC-7, illunara wrote:
> Hi everybody
> I wonder if i can catch a maya error(or warning) before it happen? Lets say 
> like this, i would like to test if an user's action will lead to an error or 
> not.
> Thanks :D

-- 
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 [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to