Get Exception handling working with Python 3
The old way to get the full stacktrace was incorrect, and does not work with Python 3: https://stackoverflow.com/questions/3702675/how-to-print-the-full-traceback-without-halting-the-program#comment84297600_33723119
This commit is contained in:
parent
88d04f3bcb
commit
7365cb8e52
|
@ -447,7 +447,15 @@ wxString PyErrStringWithTraceback()
|
|||
|
||||
PyErr_Fetch( &type, &value, &traceback );
|
||||
|
||||
PyErr_NormalizeException( &type, &value, &traceback);
|
||||
if (traceback == NULL) {
|
||||
traceback = Py_None;
|
||||
Py_INCREF( traceback );
|
||||
}
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
PyException_SetTraceback(value, traceback);
|
||||
|
||||
PyObject* tracebackModuleString = PyUnicode_FromString( "traceback" );
|
||||
#else
|
||||
PyObject* tracebackModuleString = PyString_FromString( "traceback" );
|
||||
|
|
|
@ -121,8 +121,7 @@ def LoadOnePlugin(Dirname, ModuleName):
|
|||
if NOT_LOADED_WIZARDS != "" :
|
||||
NOT_LOADED_WIZARDS += "\n"
|
||||
NOT_LOADED_WIZARDS += module_filename
|
||||
FULL_BACK_TRACE += traceback.format_exc(sys.exc_info())
|
||||
pass
|
||||
FULL_BACK_TRACE += traceback.format_exc()
|
||||
|
||||
|
||||
|
||||
|
@ -154,8 +153,7 @@ def LoadOneSubdirPlugin(Dirname, SubDirname):
|
|||
if NOT_LOADED_WIZARDS != "" :
|
||||
NOT_LOADED_WIZARDS += "\n"
|
||||
NOT_LOADED_WIZARDS += fullPath
|
||||
FULL_BACK_TRACE += traceback.format_exc(sys.exc_info())
|
||||
pass
|
||||
FULL_BACK_TRACE += traceback.format_exc()
|
||||
|
||||
else:
|
||||
if NOT_LOADED_WIZARDS != "" :
|
||||
|
|
Loading…
Reference in New Issue