[Pyobjc-dev] pyrun_string exception handling
Brought to you by:
ronaldoussoren
From: Georg S. <geo...@gm...> - 2015-08-31 14:08:56
|
Hi, I have and ObjC app that embeds some python scripting using PyRun_SimpleString(). This all works fine. For simple scripts it is easy to catch exceptions, just wrap the PyRun_SimpleString() call in a @try/@catch. But if a script adds some UI and throws an exception in a button callback, it is outside of the try block and crashes the app. Is there a way to attach an exception handler to the python environment? And what is the best way to extract the most information from the exception (traceback...) from outside of the python environment? For now I added a try block in [NSApplication sentEvent:] but that gives me only the "error message" but not the python back trace. Thanks in advance. Georg |