diff --git a/pcbnew/swig/python_scripting.cpp b/pcbnew/swig/python_scripting.cpp index 0f98bdcd44..d59f4a5554 100644 --- a/pcbnew/swig/python_scripting.cpp +++ b/pcbnew/swig/python_scripting.cpp @@ -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" ); diff --git a/scripting/kicadplugins.i b/scripting/kicadplugins.i index a7550ebf91..b828327ee4 100644 --- a/scripting/kicadplugins.i +++ b/scripting/kicadplugins.i @@ -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 != "" :