try:    myfunc()
except:
    pass

will provide the same "fire and forget" functionality as catch(`myFunc()`);
would in MEL. You can also catch specific exception types to do advanced
error handling from here.

try:    myfunc(some_arg)
except TypeError:
    print "myFunc() requires argument of type foo.\n myFunc() failed."
    pass

In this example, the user is notified that the function failed, and given
the reason, while still allowing whatever called that function to continue.

Hope this helps

-Paul



On Mon, May 18, 2009 at 8:22 AM, ynedelin <[email protected]> wrote:

>
> what is a way to catch error when in python similar to MEL?
>
> thanks
> Yury
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---

  • ... ynedelin
    • ... Richard Kazuo
    • ... kurian os ™ ®കോപ്പിയടിച്ചാല്©ഗോതമ്പുണ്ട!
    • ... frostfyre
      • ... yury nedelin
      • ... Justin Rosen

Reply via email to