If the exception was raised in Python then you should be able to do: print event.Exception.Data['PythonExceptionInfo']
which will contain the Python exception object, not that I'm sure you can format that one much better. What you probably want to do is call PythonEngine.FormatException(event.Exception), for example: from IronPython.Hosting import PythonEngine x = PythonEngine() print x.FormatException(event.Exception) If you're hosting IronPython then you can use your previously instantiated PythonEngine instead of newing one up just to format an exception. From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Laurent Debacker Sent: Tuesday, June 19, 2007 11:45 AM To: [email protected] Subject: [IronPython] .NET Exception to Python Exception conversion Hello, I'm catching exceptions raised in my winforms thread using def exceptionHandler(sender, event): print event.Exception Application.ThreadException += ThreadExceptionEventHandler(exceptionHandler) Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException) However the exception I get, contains the long, unintuitive stack trace. How can I convert it to a nice Python exception ? Regards, Laurent Debacker.
_______________________________________________ users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
