I’m hijacking pythons sys.excepthook, in order to catch all unhandled exceptions (send error e-mails).
It works well in MotionBuilder and to a degree in Max, but only if the caller is Python (say a button in a qt window). If the caller is maxscript, it seems the exception is caught and forwarded to maxscript, thus never reaching my exception handler.
I’d like to somehow catch the exception before or after it goes to maxscript, if that’s at all a posibility. Alternatively I could alter any existing code that calls python from maxscript (using a combination of Python.Execute throwOnError: False and python.GetLastError() ), but this would mean knowing about high level exception handeling scattered around out code, which smells a bit…
If someone has solved this in an elegant way, I’d love to know!