tibbs / rpms / freecad

Forked from rpms/freecad 5 years ago
Clone
Blob Blame History Raw
From 840c9e8b3c0cab7d38d410b785b140306be4e5e4 Mon Sep 17 00:00:00 2001
From: wmayer <wmayer@users.sourceforge.net>
Date: Wed, 18 Apr 2018 19:20:50 +0200
Subject: [PATCH] prepare for PyCXX 7.0

---
 src/Base/PyObjectBase.h                        |   5 +
 src/Base/Sequencer.cpp                         |   2 +-
 src/Base/VectorPyImp.cpp                       |   2 +-
 src/Gui/SplitView3DInventor.cpp                |  56 +++----
 src/Gui/TaskView/TaskDialogPython.cpp          |   2 +-
 src/Gui/View3DPy.cpp                           | 202 ++++++++++++-------------
 src/Gui/View3DViewerPy.cpp                     |  34 ++---
 src/Gui/ViewProviderPyImp.cpp                  |   4 +-
 src/Gui/WidgetFactory.cpp                      |   2 +-
 src/Mod/Part/App/AppPartPy.cpp                 |   2 +-
 src/Mod/Part/App/ArcOfConicPyImp.cpp           |   6 +-
 src/Mod/Part/App/ConePyImp.cpp                 |   2 +-
 src/Mod/Part/App/ConicPyImp.cpp                |   6 +-
 src/Mod/Part/App/CylinderPyImp.cpp             |   2 +-
 src/Mod/Part/App/Geom2d/Line2dPyImp.cpp        |  10 +-
 src/Mod/Part/App/Geom2d/Line2dSegmentPyImp.cpp |  10 +-
 src/Mod/Part/App/Geom2d/OffsetCurve2dPyImp.cpp |   3 +-
 src/Mod/Part/App/LinePyImp.cpp                 |  10 +-
 src/Mod/Part/App/LineSegmentPyImp.cpp          |  11 +-
 src/Mod/Part/App/OffsetCurvePyImp.cpp          |   3 +-
 src/Mod/Part/App/OffsetSurfacePyImp.cpp        |   3 +-
 src/Mod/Part/App/PlanePyImp.cpp                |   5 +-
 src/Mod/Part/App/PointPyImp.cpp                |   9 +-
 src/Mod/Part/App/SpherePyImp.cpp               |   2 +-
 src/Mod/Part/App/SurfaceOfExtrusionPyImp.cpp   |   3 +-
 src/Mod/Part/App/SurfaceOfRevolutionPyImp.cpp  |   3 +-
 src/Mod/Part/App/TopoShapeEdgePyImp.cpp        |   2 +-
 src/Mod/Part/App/TopoShapeFacePyImp.cpp        |   4 +-
 src/Mod/Part/App/ToroidPyImp.cpp               |   6 +-
 src/Mod/Path/App/CommandPyImp.cpp              |  12 +-
 src/Mod/Path/App/PathPyImp.cpp                 |   8 +-
 src/Mod/Path/App/TooltablePyImp.cpp            |  12 +-
 src/Mod/Sandbox/App/DocumentProtectorPy.cpp    |   6 +-
 src/Mod/TechDraw/App/AppTechDrawPy.cpp         |  10 +-
 src/Mod/TechDraw/App/DrawViewSymbolPyImp.cpp   |   2 +-
 src/Mod/TechDraw/Gui/AppTechDrawGuiPy.cpp      |   4 +-
 36 files changed, 226 insertions(+), 239 deletions(-)

diff --git a/src/Base/PyObjectBase.h b/src/Base/PyObjectBase.h
index ae9724ac47..680623b103 100644
--- a/src/Base/PyObjectBase.h
+++ b/src/Base/PyObjectBase.h
@@ -51,6 +51,11 @@
 
 #include <typeinfo>
 #include "Exception.h"
+#if PY_MAJOR_VERSION > 2
+#  ifndef PYCXX_PYTHON_2TO3
+#  define PYCXX_PYTHON_2TO3
+#  endif
+#endif
 #include <CXX/Objects.hxx>
 
 
diff --git a/src/Base/Sequencer.cpp b/src/Base/Sequencer.cpp
index 8b9fd9ff78..39888b8832 100644
--- a/src/Base/Sequencer.cpp
+++ b/src/Base/Sequencer.cpp
@@ -367,7 +367,7 @@ Py::Object ProgressIndicatorPy::next(const Py::Tuple& args)
         }
         catch (const Base::AbortException&) {
             _seq.reset();
-            throw Py::Exception("abort progress indicator");
+            throw Py::RuntimeError("abort progress indicator");
         }
     }
     return Py::None();
diff --git a/src/Base/VectorPyImp.cpp b/src/Base/VectorPyImp.cpp
index ae2e915bab..6a862e46d4 100644
--- a/src/Base/VectorPyImp.cpp
+++ b/src/Base/VectorPyImp.cpp
@@ -613,7 +613,7 @@ void  VectorPy::setLength(Py::Float arg)
     VectorPy::PointerType ptr = reinterpret_cast<VectorPy::PointerType>(_pcTwinPointer);
     double len = ptr->Length();
     if (len < 1.0e-6) {
-        throw Py::Exception(std::string("Cannot set length of null vector"));
+        throw Py::RuntimeError(std::string("Cannot set length of null vector"));
     }
 
     double val = (double)arg/len;
diff --git a/src/Gui/SplitView3DInventor.cpp b/src/Gui/SplitView3DInventor.cpp
index 6f4d5c713b..e16e19f534 100644
--- a/src/Gui/SplitView3DInventor.cpp
+++ b/src/Gui/SplitView3DInventor.cpp
@@ -450,7 +450,7 @@ AbstractSplitViewPy::~AbstractSplitViewPy()
 void AbstractSplitViewPy::testExistence()
 {
     if (!(_view && _view->getViewer(0)))
-        throw Py::Exception("Object already deleted");
+        throw Py::RuntimeError("Object already deleted");
 }
 
 Py::Object AbstractSplitViewPy::repr()
@@ -473,13 +473,13 @@ Py::Object AbstractSplitViewPy::fitAll(const Py::Tuple& args)
         _view->onMsg("ViewFit", 0);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
     return Py::None();
 }
@@ -494,13 +494,13 @@ Py::Object AbstractSplitViewPy::viewBottom(const Py::Tuple& args)
         _view->onMsg("ViewBottom", 0);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 
     return Py::None();
@@ -516,13 +516,13 @@ Py::Object AbstractSplitViewPy::viewFront(const Py::Tuple& args)
         _view->onMsg("ViewFront", 0);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 
     return Py::None();
@@ -538,13 +538,13 @@ Py::Object AbstractSplitViewPy::viewLeft(const Py::Tuple& args)
         _view->onMsg("ViewLeft", 0);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 
     return Py::None();
@@ -560,13 +560,13 @@ Py::Object AbstractSplitViewPy::viewRear(const Py::Tuple& args)
         _view->onMsg("ViewRear", 0);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 
     return Py::None();
@@ -582,13 +582,13 @@ Py::Object AbstractSplitViewPy::viewRight(const Py::Tuple& args)
         _view->onMsg("ViewRight", 0);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 
     return Py::None();
@@ -604,13 +604,13 @@ Py::Object AbstractSplitViewPy::viewTop(const Py::Tuple& args)
         _view->onMsg("ViewTop", 0);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 
     return Py::None();
@@ -626,13 +626,13 @@ Py::Object AbstractSplitViewPy::viewAxometric(const Py::Tuple& args)
         _view->onMsg("ViewAxo", 0);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 
     return Py::None();
@@ -652,13 +652,13 @@ Py::Object AbstractSplitViewPy::getViewer(const Py::Tuple& args)
         return Py::Object(view->getPyObject());
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 }
 
diff --git a/src/Gui/TaskView/TaskDialogPython.cpp b/src/Gui/TaskView/TaskDialogPython.cpp
index bbafe006c4..9ff860cf84 100644
--- a/src/Gui/TaskView/TaskDialogPython.cpp
+++ b/src/Gui/TaskView/TaskDialogPython.cpp
@@ -92,7 +92,7 @@ Py::Object ControlPy::showDialog(const Py::Tuple& args)
 {
     Gui::TaskView::TaskDialog* act = Gui::Control().activeDialog();
     if (act)
-        throw Py::Exception("Active task dialog found");
+        throw Py::RuntimeError("Active task dialog found");
     TaskDialogPython* dlg = new TaskDialogPython(args[0]);
     Gui::Control().showDialog(dlg);
     return Py::None();
diff --git a/src/Gui/View3DPy.cpp b/src/Gui/View3DPy.cpp
index 6de9bfb1de..0b89e747d2 100644
--- a/src/Gui/View3DPy.cpp
+++ b/src/Gui/View3DPy.cpp
@@ -211,13 +211,13 @@ PyObject *View3DInventorPy::method_varargs_ext_handler(PyObject *_self_and_name_
         return pycxx_handler(_self_and_name_tuple, _args);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 }
 
@@ -275,13 +275,13 @@ Py::Object View3DInventorPy::message(const Py::Tuple& args)
         _view->onMsg(psMsgStr,ppReturn);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
     return Py::None();
 }
@@ -296,13 +296,13 @@ Py::Object View3DInventorPy::fitAll(const Py::Tuple& args)
         _view->getViewer()->viewAll((float)factor);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
     return Py::None();
 }
@@ -329,13 +329,13 @@ Py::Object View3DInventorPy::viewBottom(const Py::Tuple& args)
         _view->getViewer()->setCameraOrientation(SbRotation(0, -1, 0, 0));
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 
     return Py::None();
@@ -351,13 +351,13 @@ Py::Object View3DInventorPy::viewFront(const Py::Tuple& args)
         _view->getViewer()->setCameraOrientation(SbRotation(-root, 0, 0, -root));
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 
     return Py::None();
@@ -372,13 +372,13 @@ Py::Object View3DInventorPy::viewLeft(const Py::Tuple& args)
         _view->getViewer()->setCameraOrientation(SbRotation(-0.5, 0.5, 0.5, -0.5));
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 
     return Py::None();
@@ -394,13 +394,13 @@ Py::Object View3DInventorPy::viewRear(const Py::Tuple& args)
         _view->getViewer()->setCameraOrientation(SbRotation(0, root, root, 0));
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 
     return Py::None();
@@ -415,13 +415,13 @@ Py::Object View3DInventorPy::viewRight(const Py::Tuple& args)
         _view->getViewer()->setCameraOrientation(SbRotation(0.5, 0.5, 0.5, 0.5));
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 
     return Py::None();
@@ -436,13 +436,13 @@ Py::Object View3DInventorPy::viewTop(const Py::Tuple& args)
         _view->getViewer()->setCameraOrientation(SbRotation(0, 0, 0, 1));
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 
     return Py::None();
@@ -471,13 +471,13 @@ Py::Object View3DInventorPy::viewAxonometric(const Py::Tuple& args)
              (0.424708f, 0.17592f, 0.339851f, 0.820473f));
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 
     return Py::None();
@@ -497,13 +497,13 @@ Py::Object View3DInventorPy::viewRotateLeft(const Py::Tuple& args)
       cam->orientation.setValue(rot*nrot);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 
     return Py::None();
@@ -523,13 +523,13 @@ Py::Object View3DInventorPy::viewRotateRight(const Py::Tuple& args)
       cam->orientation.setValue(rot*nrot);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 
     return Py::None();
@@ -544,13 +544,13 @@ Py::Object View3DInventorPy::zoomIn(const Py::Tuple& args)
         _view->getViewer()->navigationStyle()->zoomIn();
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 
     return Py::None();
@@ -565,13 +565,13 @@ Py::Object View3DInventorPy::zoomOut(const Py::Tuple& args)
         _view->getViewer()->navigationStyle()->zoomOut();
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 
     return Py::None();
@@ -607,13 +607,13 @@ Py::Object View3DInventorPy::setCameraOrientation(const Py::Tuple& args)
         throw; // re-throw
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 
     return Py::None();
@@ -750,14 +750,14 @@ Py::Object View3DInventorPy::saveVectorGraphic(const Py::Tuple& args)
         vo = std::unique_ptr<SoVectorizeAction>(new SoFCVectorizeU3DAction());
     }
     else {
-        throw Py::Exception("Not supported vector graphic");
+        throw Py::RuntimeError("Not supported vector graphic");
     }
 
     SoVectorOutput * out = vo->getOutput();
     if (!out || !out->openFile(filename)) {
         std::ostringstream a_out;
         a_out << "Cannot open file '" << filename << "'";
-        throw Py::Exception(a_out.str());
+        throw Py::RuntimeError(a_out.str());
     }
 
     QColor bg;
@@ -789,7 +789,7 @@ Py::Object View3DInventorPy::getCameraNode(const Py::Tuple& args)
         return Py::Object(proxy, true);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
 }
 
@@ -810,13 +810,13 @@ Py::Object View3DInventorPy::getCamera(const Py::Tuple& args)
         return Py::String(buffer);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 }
 
@@ -829,13 +829,13 @@ Py::Object View3DInventorPy::getViewDirection(const Py::Tuple& args)
         return Py::Vector(Base::Vector3f(dvec[0], dvec[1], dvec[2]));
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 }
 
@@ -863,13 +863,13 @@ Py::Object View3DInventorPy::setViewDirection(const Py::Tuple& args)
         throw; // re-throw
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 
     return Py::None();
@@ -888,13 +888,13 @@ Py::Object View3DInventorPy::setCamera(const Py::Tuple& args)
         return Py::None();
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 }
 
@@ -908,7 +908,7 @@ Py::Object View3DInventorPy::getCameraType(const Py::Tuple& args)
 
     SoCamera* cam = _view->getViewer()->getSoRenderManager()->getCamera();
     if (!cam) {
-        throw Py::Exception("No camera set!");
+        throw Py::RuntimeError("No camera set!");
     }
     else if (cam->getTypeId() == SoOrthographicCamera::getClassTypeId()) {
         return Py::String(CameraTypeEnums[0]);
@@ -917,7 +917,7 @@ Py::Object View3DInventorPy::getCameraType(const Py::Tuple& args)
         return Py::String(CameraTypeEnums[1]);
     }
     else {
-        throw Py::Exception("Unknown camera type");
+        throw Py::TypeError("Unknown camera type");
     }
 }
 
@@ -945,7 +945,7 @@ Py::Object View3DInventorPy::setCameraType(const Py::Tuple& args)
     }
 
     if (cameratype < 0 || cameratype > 1)
-        throw Py::Exception("Out of range");
+        throw Py::IndexError("Out of range");
     if (cameratype==0)
         _view->getViewer()->setCameraType(SoOrthographicCamera::getClassTypeId());
     else
@@ -966,13 +966,13 @@ Py::Object View3DInventorPy::listCameraTypes(const Py::Tuple& args)
         return list;
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 }
 
@@ -987,13 +987,13 @@ Py::Object View3DInventorPy::dump(const Py::Tuple& args)
         return Py::None();
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 }
 
@@ -1008,7 +1008,7 @@ Py::Object View3DInventorPy::dumpNode(const Py::Tuple& args)
         Base::Interpreter().convertSWIGPointerObj("pivy.coin", "SoNode *", object, &ptr, 0);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     SoNode* node = reinterpret_cast<SoNode*>(ptr);
     return Py::String(SoFCDB::writeNodesToString(node));
@@ -1042,19 +1042,19 @@ Py::Object View3DInventorPy::setStereoType(const Py::Tuple& args)
 
     try {
         if (stereomode < 0 || stereomode > 4)
-            throw Py::Exception("Out of range");
+            throw Py::IndexError("Out of range");
         Quarter::SoQTQuarterAdaptor::StereoMode mode = Quarter::SoQTQuarterAdaptor::StereoMode(stereomode);
         _view->getViewer()->setStereoMode(mode);
         return Py::None();
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 }
 
@@ -1068,13 +1068,13 @@ Py::Object View3DInventorPy::getStereoType(const Py::Tuple& args)
         return Py::String(StereoTypeEnums[mode]);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 }
 
@@ -1092,13 +1092,13 @@ Py::Object View3DInventorPy::listStereoTypes(const Py::Tuple& args)
         return list;
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 }
 
@@ -1324,7 +1324,7 @@ Py::Object View3DInventorPy::getPoint(const Py::Tuple& args)
         return Py::Vector(Base::Vector3f(pt[0], pt[1], pt[2]));
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const Py::Exception&) {
         throw;
@@ -1344,7 +1344,7 @@ Py::Object View3DInventorPy::getPointOnScreen(const Py::Tuple& args)
     else {
         PyErr_Clear();
         if (!PyArg_ParseTuple(args.ptr(), "ddd", &vx,&vy,&vz)) {
-            throw Py::Exception("Wrong argument, Vector or three floats expected expected");
+            throw Py::TypeError("Wrong argument, Vector or three floats expected expected");
         }
     }
 
@@ -1374,7 +1374,7 @@ Py::Object View3DInventorPy::getPointOnScreen(const Py::Tuple& args)
         return tuple;
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const Py::Exception&) {
         throw;
@@ -1771,14 +1771,14 @@ Py::Object View3DInventorPy::addEventCallback(const Py::Tuple& args)
         throw Py::Exception();
     try {
         if (PyCallable_Check(method) == 0) {
-            throw Py::Exception("object is not callable");
+            throw Py::TypeError("object is not callable");
         }
         SoType eventId = SoType::fromName(eventtype);
         if (eventId.isBad() || !eventId.isDerivedFrom(SoEvent::getClassTypeId())) {
             std::string s;
             std::ostringstream s_out;
             s_out << eventtype << " is not a valid event type";
-            throw Py::Exception(s_out.str());
+            throw Py::TypeError(s_out.str());
         }
 
         _view->getViewer()->addEventCallback(eventId, View3DInventorPy::eventCallback, method);
@@ -1799,14 +1799,14 @@ Py::Object View3DInventorPy::removeEventCallback(const Py::Tuple& args)
         throw Py::Exception();
     try {
         if (PyCallable_Check(method) == 0) {
-            throw Py::Exception("object is not callable");
+            throw Py::RuntimeError("object is not callable");
         }
         SoType eventId = SoType::fromName(eventtype);
         if (eventId.isBad() || !eventId.isDerivedFrom(SoEvent::getClassTypeId())) {
             std::string s;
             std::ostringstream s_out;
             s_out << eventtype << " is not a valid event type";
-            throw Py::Exception(s_out.str());
+            throw Py::TypeError(s_out.str());
         }
 
         _view->getViewer()->removeEventCallback(eventId, View3DInventorPy::eventCallback, method);
@@ -1831,7 +1831,7 @@ Py::Object View3DInventorPy::setAnnotation(const Py::Tuple& args)
     }
     catch (const Base::Exception& e) {
         delete view;
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
 
     _view->getGuiDocument()->setAnnotationViewProvider(psAnnoName, view);
@@ -1870,7 +1870,7 @@ Py::Object View3DInventorPy::getSceneGraph(const Py::Tuple& args)
         return Py::Object(proxy, true);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
 }
 
@@ -1964,7 +1964,7 @@ Py::Object View3DInventorPy::addEventCallbackPivy(const Py::Tuple& args)
         Base::Interpreter().convertSWIGPointerObj("pivy.coin", "SoType *", proxy, &ptr, 0);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
 
     SoType* eventId = reinterpret_cast<SoType*>(ptr);
@@ -1972,12 +1972,12 @@ Py::Object View3DInventorPy::addEventCallbackPivy(const Py::Tuple& args)
         std::string s;
         std::ostringstream s_out;
         s_out << eventId->getName().getString() << "is not a valid event type";
-        throw Py::Exception(s_out.str());
+        throw Py::TypeError(s_out.str());
     }
 
     try {
         if (PyCallable_Check(method) == 0) {
-            throw Py::Exception("object is not callable");
+            throw Py::TypeError("object is not callable");
         }
 
         SoEventCallbackCB* callback = (ex == 1 ? 
@@ -2006,7 +2006,7 @@ Py::Object View3DInventorPy::removeEventCallbackPivy(const Py::Tuple& args)
         Base::Interpreter().convertSWIGPointerObj("pivy.coin", "SoType *", proxy, &ptr, 0);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
 
     SoType* eventId = reinterpret_cast<SoType*>(ptr);
@@ -2014,12 +2014,12 @@ Py::Object View3DInventorPy::removeEventCallbackPivy(const Py::Tuple& args)
         std::string s;
         std::ostringstream s_out;
         s_out << eventId->getName().getString() << "is not a valid event type";
-        throw Py::Exception(s_out.str());
+        throw Py::TypeError(s_out.str());
     }
 
     try {
         if (PyCallable_Check(method) == 0) {
-            throw Py::Exception("object is not callable");
+            throw Py::TypeError("object is not callable");
         }
 
         SoEventCallbackCB* callback = (ex == 1 ? 
@@ -2066,7 +2066,7 @@ void View3DInventorPy::draggerCallback(void * ud, SoDragger* n)
         method.apply(args);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const Py::Exception& e) {
         Py::Object o = Py::type(e);
@@ -2098,13 +2098,13 @@ Py::Object View3DInventorPy::addDraggerCallback(const Py::Tuple& args)
         Base::Interpreter().convertSWIGPointerObj("pivy.coin", "SoDragger *", dragger, &ptr, 0);
     }
     catch (const Base::Exception&) {
-        throw Py::Exception("The first argument must be of type SoDragger");
+        throw Py::TypeError("The first argument must be of type SoDragger");
     }
     SoDragger* drag = reinterpret_cast<SoDragger*>(ptr);
 
     //Check if method is callable
     if (PyCallable_Check(method) == 0) {
-        throw Py::Exception("the method is not callable");
+        throw Py::TypeError("the method is not callable");
     }
 
     try {
@@ -2124,7 +2124,7 @@ Py::Object View3DInventorPy::addDraggerCallback(const Py::Tuple& args)
             std::string s;
             std::ostringstream s_out;
             s_out << type << " is not a valid dragger callback type";
-            throw Py::Exception(s_out.str());
+            throw Py::TypeError(s_out.str());
         }
 
         callbacks.push_back(method);
@@ -2150,7 +2150,7 @@ Py::Object View3DInventorPy::removeDraggerCallback(const Py::Tuple& args)
         Base::Interpreter().convertSWIGPointerObj("pivy.coin", "SoDragger *", dragger, &ptr, 0);
     }
     catch (const Base::Exception&) {
-        throw Py::Exception("The first argument must be of type SoDragger");
+        throw Py::TypeError("The first argument must be of type SoDragger");
     }
 
     SoDragger* drag = reinterpret_cast<SoDragger*>(ptr);
@@ -2171,7 +2171,7 @@ Py::Object View3DInventorPy::removeDraggerCallback(const Py::Tuple& args)
             std::string s;
             std::ostringstream s_out;
             s_out << type << " is not a valid dragger callback type";
-            throw Py::Exception(s_out.str());
+            throw Py::TypeError(s_out.str());
         }
 
         callbacks.remove(method);
diff --git a/src/Gui/View3DViewerPy.cpp b/src/Gui/View3DViewerPy.cpp
index 0fea51a2cc..dc5c3d8d43 100644
--- a/src/Gui/View3DViewerPy.cpp
+++ b/src/Gui/View3DViewerPy.cpp
@@ -107,13 +107,13 @@ PyObject *View3DInventorViewerPy::method_varargs_ext_handler(PyObject *_self_and
         return pycxx_handler(_self_and_name_tuple, _args);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 }
 
@@ -162,7 +162,7 @@ Py::Object View3DInventorViewerPy::getSoRenderManager(const Py::Tuple& args)
         return Py::Object(proxy, true);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
 }
 
@@ -179,7 +179,7 @@ Py::Object View3DInventorViewerPy::getSceneGraph(const Py::Tuple& args)
         return Py::Object(proxy, true);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
 }
 
@@ -197,7 +197,7 @@ Py::Object View3DInventorViewerPy::setSceneGraph(const Py::Tuple& args)
         return Py::None();
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
 }
 
@@ -213,7 +213,7 @@ Py::Object View3DInventorViewerPy::getSoEventManager(const Py::Tuple& args)
         return Py::Object(proxy, true);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
 }
 
@@ -265,13 +265,13 @@ Py::Object View3DInventorViewerPy::setFocalDistance(const Py::Tuple& args)
         throw; // re-throw
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
     
     return Py::None();
@@ -287,13 +287,13 @@ Py::Object View3DInventorViewerPy::getFocalDistance(const Py::Tuple& args)
         return Py::Float(d);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 }
 
@@ -311,7 +311,7 @@ Py::Object View3DInventorViewerPy::getPoint(const Py::Tuple& args)
         return Py::Vector(Base::Vector3f(pt[0], pt[1], pt[2]));
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const Py::Exception&) {
         throw;
@@ -342,12 +342,12 @@ Py::Object View3DInventorViewerPy::setPickRadius(const Py::Tuple& args)
         return Py::None();
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 }
diff --git a/src/Gui/ViewProviderPyImp.cpp b/src/Gui/ViewProviderPyImp.cpp
index 9a7cfd78e1..90a59b6372 100644
--- a/src/Gui/ViewProviderPyImp.cpp
+++ b/src/Gui/ViewProviderPyImp.cpp
@@ -306,7 +306,7 @@ Py::Object ViewProviderPy::getAnnotation(void) const
         return Py::Object(Ptr, true);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
 }
 
@@ -324,7 +324,7 @@ Py::Object ViewProviderPy::getRootNode(void) const
         return Py::Object(Ptr, true);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
 }
 
diff --git a/src/Gui/WidgetFactory.cpp b/src/Gui/WidgetFactory.cpp
index 4b49c0116b..d1340f9617 100644
--- a/src/Gui/WidgetFactory.cpp
+++ b/src/Gui/WidgetFactory.cpp
@@ -870,7 +870,7 @@ Py::Object UiLoaderPy::load(const Py::Tuple& args)
             }
         }
         else {
-            throw Py::Exception("string or QIODevice expected");
+            throw Py::TypeError("string or QIODevice expected");
         }
     }
     return Py::None();
diff --git a/src/Mod/Part/App/AppPartPy.cpp b/src/Mod/Part/App/AppPartPy.cpp
index 944a9868c1..7639423c7f 100644
--- a/src/Mod/Part/App/AppPartPy.cpp
+++ b/src/Mod/Part/App/AppPartPy.cpp
@@ -1277,7 +1277,7 @@ class Module : public Py::ExtensionModule<Module>
         PyObject *pleft=Py_False;
         if (!PyArg_ParseTuple(args.ptr(), "ddd|dO!", &pitch, &height, &radius, &angle,
                                                &(PyBool_Type), &pleft)) {
-            throw Py::Exception("Part.makeLongHelix fails on parms");
+            throw Py::RuntimeError("Part.makeLongHelix fails on parms");
         }
 
         try {
diff --git a/src/Mod/Part/App/ArcOfConicPyImp.cpp b/src/Mod/Part/App/ArcOfConicPyImp.cpp
index dd2c8554fc..1790d13193 100644
--- a/src/Mod/Part/App/ArcOfConicPyImp.cpp
+++ b/src/Mod/Part/App/ArcOfConicPyImp.cpp
@@ -148,7 +148,7 @@ void  ArcOfConicPy::setAxis(Py::Object arg)
         conic->SetAxis(axis);
     }
     catch (Standard_Failure) {
-        throw Py::Exception("cannot set axis");
+        throw Py::RuntimeError("cannot set axis");
     }
 }
 
@@ -188,7 +188,7 @@ void  ArcOfConicPy::setXAxis(Py::Object arg)
         conic->SetPosition(pos);
     }
     catch (Standard_Failure) {
-        throw Py::Exception("cannot set X axis");
+        throw Py::RuntimeError("cannot set X axis");
     }
 }
 
@@ -228,7 +228,7 @@ void  ArcOfConicPy::setYAxis(Py::Object arg)
         conic->SetPosition(pos);
     }
     catch (Standard_Failure) {
-        throw Py::Exception("cannot set Y axis");
+        throw Py::RuntimeError("cannot set Y axis");
     }
 }
 
diff --git a/src/Mod/Part/App/ConePyImp.cpp b/src/Mod/Part/App/ConePyImp.cpp
index 299644eec5..0316211e7d 100644
--- a/src/Mod/Part/App/ConePyImp.cpp
+++ b/src/Mod/Part/App/ConePyImp.cpp
@@ -296,7 +296,7 @@ void ConePy::setAxis(Py::Object arg)
         this_surf->SetAxis(axis);
     }
     catch (Standard_Failure) {
-        throw Py::Exception("cannot set axis");
+        throw Py::RuntimeError("cannot set axis");
     }
 }
 
diff --git a/src/Mod/Part/App/ConicPyImp.cpp b/src/Mod/Part/App/ConicPyImp.cpp
index 755ff5db6a..94a2fea337 100644
--- a/src/Mod/Part/App/ConicPyImp.cpp
+++ b/src/Mod/Part/App/ConicPyImp.cpp
@@ -151,7 +151,7 @@ void  ConicPy::setAxis(Py::Object arg)
         conic->SetAxis(axis);
     }
     catch (Standard_Failure) {
-        throw Py::Exception("cannot set axis");
+        throw Py::RuntimeError("cannot set axis");
     }
 }
 
@@ -187,7 +187,7 @@ void  ConicPy::setXAxis(Py::Object arg)
         conic->SetPosition(pos);
     }
     catch (Standard_Failure) {
-        throw Py::Exception("cannot set X axis");
+        throw Py::RuntimeError("cannot set X axis");
     }
 }
 
@@ -223,7 +223,7 @@ void  ConicPy::setYAxis(Py::Object arg)
         conic->SetPosition(pos);
     }
     catch (Standard_Failure) {
-        throw Py::Exception("cannot set Y axis");
+        throw Py::RuntimeError("cannot set Y axis");
     }
 }
 
diff --git a/src/Mod/Part/App/CylinderPyImp.cpp b/src/Mod/Part/App/CylinderPyImp.cpp
index 13f171e70a..3b2f412db9 100644
--- a/src/Mod/Part/App/CylinderPyImp.cpp
+++ b/src/Mod/Part/App/CylinderPyImp.cpp
@@ -293,7 +293,7 @@ void CylinderPy::setAxis(Py::Object arg)
         this_surf->SetAxis(axis);
     }
     catch (Standard_Failure) {
-        throw Py::Exception("cannot set axis");
+        throw Py::RuntimeError("cannot set axis");
     }
 }
 
diff --git a/src/Mod/Part/App/Geom2d/Line2dPyImp.cpp b/src/Mod/Part/App/Geom2d/Line2dPyImp.cpp
index 476fd3445e..ba45036714 100644
--- a/src/Mod/Part/App/Geom2d/Line2dPyImp.cpp
+++ b/src/Mod/Part/App/Geom2d/Line2dPyImp.cpp
@@ -163,7 +163,7 @@ void Line2dPy::setLocation(Py::Object arg)
     try {
         GCE2d_MakeLine ms(pnt, dir);
         if (!ms.IsDone()) {
-            throw Py::Exception(gce_ErrorStatusText(ms.Status()));
+            throw Py::RuntimeError(gce_ErrorStatusText(ms.Status()));
         }
 
         // get Geom_Line of line
@@ -171,8 +171,7 @@ void Line2dPy::setLocation(Py::Object arg)
         this_line->SetLin2d(that_line->Lin2d());
     }
     catch (Standard_Failure& e) {
-
-        throw Py::Exception(e.GetMessageString());
+        throw Py::RuntimeError(e.GetMessageString());
     }
 }
 
@@ -218,7 +217,7 @@ void Line2dPy::setDirection(Py::Object arg)
     try {
         GCE2d_MakeLine ms(pnt, dir);
         if (!ms.IsDone()) {
-            throw Py::Exception(gce_ErrorStatusText(ms.Status()));
+            throw Py::RuntimeError(gce_ErrorStatusText(ms.Status()));
         }
 
         // get Geom_Line of line
@@ -226,8 +225,7 @@ void Line2dPy::setDirection(Py::Object arg)
         this_line->SetLin2d(that_line->Lin2d());
     }
     catch (Standard_Failure& e) {
-
-        throw Py::Exception(e.GetMessageString());
+        throw Py::RuntimeError(e.GetMessageString());
     }
 }
 
diff --git a/src/Mod/Part/App/Geom2d/Line2dSegmentPyImp.cpp b/src/Mod/Part/App/Geom2d/Line2dSegmentPyImp.cpp
index 2c3b8dde7f..6b6a1165b7 100644
--- a/src/Mod/Part/App/Geom2d/Line2dSegmentPyImp.cpp
+++ b/src/Mod/Part/App/Geom2d/Line2dSegmentPyImp.cpp
@@ -240,7 +240,7 @@ void Line2dSegmentPy::setStartPoint(Py::Object arg)
             Standard_Failure::Raise("Both points are equal");
         GCE2d_MakeSegment ms(p1, p2);
         if (!ms.IsDone()) {
-            throw Py::Exception(gce_ErrorStatusText(ms.Status()));
+            throw Py::RuntimeError(gce_ErrorStatusText(ms.Status()));
         }
 
         // get Geom_Line of line segment
@@ -252,8 +252,7 @@ void Line2dSegmentPy::setStartPoint(Py::Object arg)
         this_curv->SetTrim(that_curv->FirstParameter(), that_curv->LastParameter());
     }
     catch (Standard_Failure& e) {
-
-        throw Py::Exception(e.GetMessageString());
+        throw Py::RuntimeError(e.GetMessageString());
     }
 }
 
@@ -301,7 +300,7 @@ void Line2dSegmentPy::setEndPoint(Py::Object arg)
             Standard_Failure::Raise("Both points are equal");
         GCE2d_MakeSegment ms(p1, p2);
         if (!ms.IsDone()) {
-            throw Py::Exception(gce_ErrorStatusText(ms.Status()));
+            throw Py::RuntimeError(gce_ErrorStatusText(ms.Status()));
         }
 
         // get Geom_Line of line segment
@@ -313,8 +312,7 @@ void Line2dSegmentPy::setEndPoint(Py::Object arg)
         this_curv->SetTrim(that_curv->FirstParameter(), that_curv->LastParameter());
     }
     catch (Standard_Failure& e) {
-
-        throw Py::Exception(e.GetMessageString());
+        throw Py::RuntimeError(e.GetMessageString());
     }
 }
 
diff --git a/src/Mod/Part/App/Geom2d/OffsetCurve2dPyImp.cpp b/src/Mod/Part/App/Geom2d/OffsetCurve2dPyImp.cpp
index e852a2a5fb..e082168a80 100644
--- a/src/Mod/Part/App/Geom2d/OffsetCurve2dPyImp.cpp
+++ b/src/Mod/Part/App/Geom2d/OffsetCurve2dPyImp.cpp
@@ -122,8 +122,7 @@ void OffsetCurve2dPy::setBasisCurve(Py::Object arg)
             curve2->SetBasisCurve(curve);
         }
         catch (Standard_Failure& e) {
-    
-            throw Py::Exception(e.GetMessageString());
+            throw Py::RuntimeError(e.GetMessageString());
         }
     }
 }
diff --git a/src/Mod/Part/App/LinePyImp.cpp b/src/Mod/Part/App/LinePyImp.cpp
index 6bb058b873..fe3f4c4ac6 100644
--- a/src/Mod/Part/App/LinePyImp.cpp
+++ b/src/Mod/Part/App/LinePyImp.cpp
@@ -161,7 +161,7 @@ void LinePy::setLocation(Py::Object arg)
     try {
         GC_MakeLine ms(pnt, dir);
         if (!ms.IsDone()) {
-            throw Py::Exception(gce_ErrorStatusText(ms.Status()));
+            throw Py::RuntimeError(gce_ErrorStatusText(ms.Status()));
         }
 
         // get Geom_Line of line
@@ -169,8 +169,7 @@ void LinePy::setLocation(Py::Object arg)
         this_curv->SetLin(that_curv->Lin());
     }
     catch (Standard_Failure& e) {
-
-        throw Py::Exception(e.GetMessageString());
+        throw Py::RuntimeError(e.GetMessageString());
     }
 }
 
@@ -211,7 +210,7 @@ void LinePy::setDirection(Py::Object arg)
     try {
         GC_MakeLine ms(pnt, dir);
         if (!ms.IsDone()) {
-            throw Py::Exception(gce_ErrorStatusText(ms.Status()));
+            throw Py::RuntimeError(gce_ErrorStatusText(ms.Status()));
         }
 
         // get Geom_Line of line
@@ -219,8 +218,7 @@ void LinePy::setDirection(Py::Object arg)
         this_curv->SetLin(that_curv->Lin());
     }
     catch (Standard_Failure& e) {
-
-        throw Py::Exception(e.GetMessageString());
+        throw Py::RuntimeError(e.GetMessageString());
     }
 }
 
diff --git a/src/Mod/Part/App/LineSegmentPyImp.cpp b/src/Mod/Part/App/LineSegmentPyImp.cpp
index 2d8577cedc..0ad0854171 100644
--- a/src/Mod/Part/App/LineSegmentPyImp.cpp
+++ b/src/Mod/Part/App/LineSegmentPyImp.cpp
@@ -196,7 +196,6 @@ PyObject* LineSegmentPy::setParameterRange(PyObject *args)
         this_curve->SetTrim(first, last);
     }
     catch (Standard_Failure& e) {
-
         PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
         return NULL;
     }
@@ -244,7 +243,7 @@ void LineSegmentPy::setStartPoint(Py::Object arg)
             Standard_Failure::Raise("Both points are equal");
         GC_MakeSegment ms(p1, p2);
         if (!ms.IsDone()) {
-            throw Py::Exception(gce_ErrorStatusText(ms.Status()));
+            throw Py::RuntimeError(gce_ErrorStatusText(ms.Status()));
         }
 
         // get Geom_Line of line segment
@@ -256,8 +255,7 @@ void LineSegmentPy::setStartPoint(Py::Object arg)
         this_curv->SetTrim(that_curv->FirstParameter(), that_curv->LastParameter());
     }
     catch (Standard_Failure& e) {
-
-        throw Py::Exception(e.GetMessageString());
+        throw Py::RuntimeError(e.GetMessageString());
     }
 }
 
@@ -301,7 +299,7 @@ void LineSegmentPy::setEndPoint(Py::Object arg)
             Standard_Failure::Raise("Both points are equal");
         GC_MakeSegment ms(p1, p2);
         if (!ms.IsDone()) {
-            throw Py::Exception(gce_ErrorStatusText(ms.Status()));
+            throw Py::RuntimeError(gce_ErrorStatusText(ms.Status()));
         }
 
         // get Geom_Line of line segment
@@ -313,8 +311,7 @@ void LineSegmentPy::setEndPoint(Py::Object arg)
         this_curv->SetTrim(that_curv->FirstParameter(), that_curv->LastParameter());
     }
     catch (Standard_Failure& e) {
-
-        throw Py::Exception(e.GetMessageString());
+        throw Py::RuntimeError(e.GetMessageString());
     }
 }
 
diff --git a/src/Mod/Part/App/OffsetCurvePyImp.cpp b/src/Mod/Part/App/OffsetCurvePyImp.cpp
index 1849764e8a..839ef667bc 100644
--- a/src/Mod/Part/App/OffsetCurvePyImp.cpp
+++ b/src/Mod/Part/App/OffsetCurvePyImp.cpp
@@ -145,8 +145,7 @@ void OffsetCurvePy::setBasisCurve(Py::Object arg)
             curve2->SetBasisCurve(curve);
         }
         catch (Standard_Failure& e) {
-    
-            throw Py::Exception(e.GetMessageString());
+                throw Py::RuntimeError(e.GetMessageString());
         }
     }
 }
diff --git a/src/Mod/Part/App/OffsetSurfacePyImp.cpp b/src/Mod/Part/App/OffsetSurfacePyImp.cpp
index 2e2996e47d..32d44cd446 100644
--- a/src/Mod/Part/App/OffsetSurfacePyImp.cpp
+++ b/src/Mod/Part/App/OffsetSurfacePyImp.cpp
@@ -120,8 +120,7 @@ void  OffsetSurfacePy::setBasisSurface(Py::Object arg)
             surf2->SetBasisSurface(surf);
         }
         catch (Standard_Failure& e) {
-    
-            throw Py::Exception(e.GetMessageString());
+            throw Py::RuntimeError(e.GetMessageString());
         }
     }
 }
diff --git a/src/Mod/Part/App/PlanePyImp.cpp b/src/Mod/Part/App/PlanePyImp.cpp
index 863dd7fb22..aa2ac03164 100644
--- a/src/Mod/Part/App/PlanePyImp.cpp
+++ b/src/Mod/Part/App/PlanePyImp.cpp
@@ -208,8 +208,7 @@ void PlanePy::setPosition(Py::Object arg)
         this_surf->SetLocation(loc);
     }
     catch (Standard_Failure& e) {
-
-        throw Py::Exception(e.GetMessageString());
+        throw Py::RuntimeError(e.GetMessageString());
     }
 }
 
@@ -252,7 +251,7 @@ void PlanePy::setAxis(Py::Object arg)
         this_surf->SetAxis(axis);
     }
     catch (Standard_Failure) {
-        throw Py::Exception("cannot set axis");
+        throw Py::RuntimeError("cannot set axis");
     }
 }
 
diff --git a/src/Mod/Part/App/PointPyImp.cpp b/src/Mod/Part/App/PointPyImp.cpp
index 115e0a56d9..3502ea85b6 100644
--- a/src/Mod/Part/App/PointPyImp.cpp
+++ b/src/Mod/Part/App/PointPyImp.cpp
@@ -144,8 +144,7 @@ void PointPy::setX(Py::Float X)
         this_point->SetX(double(X));
     }
     catch (Standard_Failure& e) {
-
-        throw Py::Exception(e.GetMessageString());
+        throw Py::RuntimeError(e.GetMessageString());
     }
 }
 
@@ -165,8 +164,7 @@ void PointPy::setY(Py::Float Y)
         this_point->SetY(double(Y));
     }
     catch (Standard_Failure& e) {
-
-        throw Py::Exception(e.GetMessageString());
+        throw Py::RuntimeError(e.GetMessageString());
     }
 }
 
@@ -186,8 +184,7 @@ void PointPy::setZ(Py::Float Z)
         this_point->SetZ(double(Z));
     }
     catch (Standard_Failure& e) {
-
-        throw Py::Exception(e.GetMessageString());
+        throw Py::RuntimeError(e.GetMessageString());
     }
 }
 
diff --git a/src/Mod/Part/App/SpherePyImp.cpp b/src/Mod/Part/App/SpherePyImp.cpp
index 13f93577b4..7220da3cf4 100644
--- a/src/Mod/Part/App/SpherePyImp.cpp
+++ b/src/Mod/Part/App/SpherePyImp.cpp
@@ -177,7 +177,7 @@ void SpherePy::setAxis(Py::Object arg)
         this_surf->SetAxis(axis);
     }
     catch (Standard_Failure) {
-        throw Py::Exception("cannot set axis");
+        throw Py::RuntimeError("cannot set axis");
     }
 }
 
diff --git a/src/Mod/Part/App/SurfaceOfExtrusionPyImp.cpp b/src/Mod/Part/App/SurfaceOfExtrusionPyImp.cpp
index 201dc878d2..0df2611b78 100644
--- a/src/Mod/Part/App/SurfaceOfExtrusionPyImp.cpp
+++ b/src/Mod/Part/App/SurfaceOfExtrusionPyImp.cpp
@@ -139,8 +139,7 @@ void  SurfaceOfExtrusionPy::setBasisCurve(Py::Object arg)
             curve2->SetBasisCurve(curve);
         }
         catch (Standard_Failure& e) {
-    
-            throw Py::Exception(e.GetMessageString());
+            throw Py::RuntimeError(e.GetMessageString());
         }
     }
 }
diff --git a/src/Mod/Part/App/SurfaceOfRevolutionPyImp.cpp b/src/Mod/Part/App/SurfaceOfRevolutionPyImp.cpp
index b467accecf..fbb6fe20e1 100644
--- a/src/Mod/Part/App/SurfaceOfRevolutionPyImp.cpp
+++ b/src/Mod/Part/App/SurfaceOfRevolutionPyImp.cpp
@@ -166,8 +166,7 @@ void  SurfaceOfRevolutionPy::setBasisCurve(Py::Object arg)
             curve2->SetBasisCurve(curve);
         }
         catch (Standard_Failure& e) {
-    
-            throw Py::Exception(e.GetMessageString());
+            throw Py::RuntimeError(e.GetMessageString());
         }
     }
 }
diff --git a/src/Mod/Part/App/TopoShapeEdgePyImp.cpp b/src/Mod/Part/App/TopoShapeEdgePyImp.cpp
index 633fd88052..f0a046887b 100644
--- a/src/Mod/Part/App/TopoShapeEdgePyImp.cpp
+++ b/src/Mod/Part/App/TopoShapeEdgePyImp.cpp
@@ -1000,7 +1000,7 @@ Py::Dict TopoShapeEdgePy::getPrincipalProperties(void) const
 Py::Boolean TopoShapeEdgePy::getClosed(void) const
 {
     if (getTopoShapePtr()->getShape().IsNull())
-        throw Py::Exception("Cannot determine the 'Closed'' flag of an empty shape");
+        throw Py::RuntimeError("Cannot determine the 'Closed'' flag of an empty shape");
     Standard_Boolean ok = BRep_Tool::IsClosed(getTopoShapePtr()->getShape());
     return Py::Boolean(ok ? true : false);
 }
diff --git a/src/Mod/Part/App/TopoShapeFacePyImp.cpp b/src/Mod/Part/App/TopoShapeFacePyImp.cpp
index a270a47cfe..0f9a7df0dd 100644
--- a/src/Mod/Part/App/TopoShapeFacePyImp.cpp
+++ b/src/Mod/Part/App/TopoShapeFacePyImp.cpp
@@ -873,14 +873,14 @@ Py::Object TopoShapeFacePy::getOuterWire(void) const
 {
     const TopoDS_Shape& clSh = getTopoShapePtr()->getShape();
     if (clSh.IsNull())
-        throw Py::Exception("Null shape");
+        throw Py::RuntimeError("Null shape");
     if (clSh.ShapeType() == TopAbs_FACE) {
         TopoDS_Face clFace = (TopoDS_Face&)clSh;
         TopoDS_Wire clWire = ShapeAnalysis::OuterWire(clFace);
         return Py::Object(new TopoShapeWirePy(new TopoShape(clWire)),true);
     }
     else {
-        throw Py::Exception("Internal error, TopoDS_Shape is not a face!");
+        throw Py::TypeError("Internal error, TopoDS_Shape is not a face!");
     }
 }
 
diff --git a/src/Mod/Part/App/ToroidPyImp.cpp b/src/Mod/Part/App/ToroidPyImp.cpp
index 33642b8b0b..18bbcec911 100644
--- a/src/Mod/Part/App/ToroidPyImp.cpp
+++ b/src/Mod/Part/App/ToroidPyImp.cpp
@@ -119,7 +119,7 @@ void ToroidPy::setMajorRadius(Py::Float arg)
         torus->SetMajorRadius((double)arg);
     }
     catch (Standard_Failure) {
-        throw Py::Exception("Major radius must be positive and higher than minor radius");
+        throw Py::RuntimeError("Major radius must be positive and higher than minor radius");
     }
 }
 
@@ -138,7 +138,7 @@ void ToroidPy::setMinorRadius(Py::Float arg)
         torus->SetMinorRadius((double)arg);
     }
     catch (Standard_Failure) {
-        throw Py::Exception("Minor radius must be positive and lower than major radius");
+        throw Py::RuntimeError("Minor radius must be positive and lower than major radius");
     }
 }
 
@@ -205,7 +205,7 @@ void ToroidPy::setAxis(Py::Object arg)
         this_surf->SetAxis(axis);
     }
     catch (Standard_Failure) {
-        throw Py::Exception("cannot set axis");
+        throw Py::RuntimeError("cannot set axis");
     }
 }
 
diff --git a/src/Mod/Path/App/CommandPyImp.cpp b/src/Mod/Path/App/CommandPyImp.cpp
index 6d302af130..7bf469c578 100644
--- a/src/Mod/Path/App/CommandPyImp.cpp
+++ b/src/Mod/Path/App/CommandPyImp.cpp
@@ -168,7 +168,7 @@ void CommandPy::setParameters(Py::Dict arg)
 #endif
         }
         else {
-            throw Py::Exception("The dictionary can only contain string keys");
+            throw Py::TypeError("The dictionary can only contain string keys");
         }
 
         boost::to_upper(ckey);
@@ -185,7 +185,7 @@ void CommandPy::setParameters(Py::Dict arg)
             cvalue = PyFloat_AsDouble(value);
         }
         else {
-            throw Py::Exception("The dictionary can only contain number values");
+            throw Py::TypeError("The dictionary can only contain number values");
         }
         getCommandPtr()->Parameters[ckey]=cvalue;
     }
@@ -202,7 +202,7 @@ PyObject* CommandPy::toGCode(PyObject *args)
         return PyString_FromString(getCommandPtr()->toGCode().c_str());
 #endif
     }
-    throw Py::Exception("This method accepts no argument");
+    throw Py::TypeError("This method accepts no argument");
 }
 
 PyObject* CommandPy::setFromGCode(PyObject *args)
@@ -214,7 +214,7 @@ PyObject* CommandPy::setFromGCode(PyObject *args)
         Py_INCREF(Py_None);
         return Py_None;
     }
-    throw Py::Exception("Argument must be a string");
+    throw Py::TypeError("Argument must be a string");
 }
 
 // Placement attribute get/set
@@ -231,7 +231,7 @@ void CommandPy::setPlacement(Py::Object arg)
     if(arg.isType(PlacementType)) {
         getCommandPtr()->setFromPlacement( *static_cast<Base::PlacementPy*>((*arg))->getPlacementPtr() );
     } else
-    throw Py::Exception("Argument must be a placement");
+    throw Py::TypeError("Argument must be a placement");
 }
 
 PyObject* CommandPy::transform(PyObject *args)
@@ -242,7 +242,7 @@ PyObject* CommandPy::transform(PyObject *args)
         Path::Command trCmd = getCommandPtr()->transform( *p->getPlacementPtr() );
         return new CommandPy(new Path::Command(trCmd));
     } else
-    throw Py::Exception("Argument must be a placement");
+    throw Py::TypeError("Argument must be a placement");
 }
 
 // custom attributes get/set
diff --git a/src/Mod/Path/App/PathPyImp.cpp b/src/Mod/Path/App/PathPyImp.cpp
index 3bba29b46f..11de15a4f5 100644
--- a/src/Mod/Path/App/PathPyImp.cpp
+++ b/src/Mod/Path/App/PathPyImp.cpp
@@ -100,7 +100,7 @@ void PathPy::setCommands(Py::List list)
             Path::Command &cmd = *static_cast<Path::CommandPy*>((*it).ptr())->getCommandPtr();
             getToolpathPtr()->addCommand(cmd);
         } else {
-            throw Py::Exception("The list can only contain Path Commands");
+            throw Py::TypeError("The list can only contain Path Commands");
         }
     }
 }
@@ -124,7 +124,7 @@ PyObject* PathPy::copy(PyObject * args)
     if (PyArg_ParseTuple(args, "")) {
         return new PathPy(new Path::Toolpath(*getToolpathPtr()));
     }
-    throw Py::Exception("This method accepts no argument");
+    throw Py::TypeError("This method accepts no argument");
 }
 
 PyObject* PathPy::addCommands(PyObject * args)
@@ -184,7 +184,7 @@ PyObject* PathPy::toGCode(PyObject * args)
         return PyString_FromString(result.c_str());
 #endif
     }
-    throw Py::Exception("This method accepts no argument");
+    throw Py::TypeError("This method accepts no argument");
 }
 
 PyObject* PathPy::setFromGCode(PyObject * args)
@@ -196,7 +196,7 @@ PyObject* PathPy::setFromGCode(PyObject * args)
         Py_INCREF(Py_None);
         return Py_None;
     }
-    throw Py::Exception("Argument must be a string");
+    throw Py::TypeError("Argument must be a string");
 }
 
 // custom attributes get/set
diff --git a/src/Mod/Path/App/TooltablePyImp.cpp b/src/Mod/Path/App/TooltablePyImp.cpp
index 63e4adfdaa..17cb3fe59e 100644
--- a/src/Mod/Path/App/TooltablePyImp.cpp
+++ b/src/Mod/Path/App/TooltablePyImp.cpp
@@ -223,7 +223,7 @@ PyObject* ToolPy::copy(PyObject * args)
     if (PyArg_ParseTuple(args, "")) {
         return new ToolPy(new Path::Tool(*getToolPtr()));
     }
-    throw Py::Exception("This method accepts no argument");
+    throw Py::TypeError("This method accepts no argument");
 }
 
 PyObject* ToolPy::setFromTemplate(PyObject * args)
@@ -276,7 +276,7 @@ PyObject* ToolPy::templateAttrs(PyObject * args)
         PyDict_SetItemString(dict, "cuttingEdgeHeight", PyFloat_FromDouble(getToolPtr()->CuttingEdgeHeight));
         return dict;
     }
-    throw Py::Exception("This method accepts no argument");
+    throw Py::TypeError("This method accepts no argument");
 }
 
 PyObject* ToolPy::getToolTypes(PyObject * args)
@@ -290,7 +290,7 @@ PyObject* ToolPy::getToolTypes(PyObject * args)
         }
         return list;
     }
-    throw Py::Exception("This method accepts no argument");
+    throw Py::TypeError("This method accepts no argument");
 }
 
 PyObject* ToolPy::getToolMaterials(PyObject * args)
@@ -304,7 +304,7 @@ PyObject* ToolPy::getToolMaterials(PyObject * args)
         }
         return list;
     }
-    throw Py::Exception("This method accepts no argument");
+    throw Py::TypeError("This method accepts no argument");
 }
 
 
@@ -405,7 +405,7 @@ void TooltablePy::setTools(Py::Dict arg)
               Py_DECREF(success);
             }
         } else {
-            throw Py::Exception("The dictionary can only contain int:tool pairs");
+            throw Py::TypeError("The dictionary can only contain int:tool pairs");
         }
     }
 }
@@ -417,7 +417,7 @@ PyObject* TooltablePy::copy(PyObject * args)
     if (PyArg_ParseTuple(args, "")) {
         return new TooltablePy(new Path::Tooltable(*getTooltablePtr()));
     }
-    throw Py::Exception("This method accepts no argument");
+    throw Py::TypeError("This method accepts no argument");
 }
 
 PyObject* TooltablePy::addTools(PyObject * args)
diff --git a/src/Mod/Sandbox/App/DocumentProtectorPy.cpp b/src/Mod/Sandbox/App/DocumentProtectorPy.cpp
index a02b803a06..5e5e1ca271 100644
--- a/src/Mod/Sandbox/App/DocumentProtectorPy.cpp
+++ b/src/Mod/Sandbox/App/DocumentProtectorPy.cpp
@@ -79,13 +79,13 @@ PyObject *DocumentProtectorPy::method_varargs_ext_handler(PyObject *_self_and_na
         return pycxx_handler(_self_and_name_tuple, _args);
     }
     catch (const Base::Exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch (const std::exception& e) {
-        throw Py::Exception(e.what());
+        throw Py::RuntimeError(e.what());
     }
     catch(...) {
-        throw Py::Exception("Unknown C++ exception");
+        throw Py::RuntimeError("Unknown C++ exception");
     }
 }
 
diff --git a/src/Mod/TechDraw/App/AppTechDrawPy.cpp b/src/Mod/TechDraw/App/AppTechDrawPy.cpp
index a793f38d43..512e5588d3 100644
--- a/src/Mod/TechDraw/App/AppTechDrawPy.cpp
+++ b/src/Mod/TechDraw/App/AppTechDrawPy.cpp
@@ -134,7 +134,7 @@ class Module : public Py::ExtensionModule<Module>
         PyObject *pcObj;
         PyObject *inclBig = Py_True;
         if (!PyArg_ParseTuple(args.ptr(), "O!|O", &(PyList_Type), &pcObj, &inclBig)) {
-            throw Py::Exception("expected (listofedges,boolean");
+            throw Py::TypeError("expected (listofedges,boolean");
         }
 
         std::vector<TopoDS_Edge> edgeList;
@@ -191,7 +191,7 @@ class Module : public Py::ExtensionModule<Module>
     {
         PyObject *pcObj;
         if (!PyArg_ParseTuple(args.ptr(), "O!", &(PyList_Type), &pcObj)) {
-            throw Py::Exception("expected (listofedges)");
+            throw Py::TypeError("expected (listofedges)");
         }
 
         std::vector<TopoDS_Edge> edgeList;
@@ -248,7 +248,7 @@ class Module : public Py::ExtensionModule<Module>
         if (!PyArg_ParseTuple(args.ptr(), "OdO", &pcObjShape,
                                                  &scale,
                                                  &pcObjDir)) {
-            throw Py::Exception("expected (shape,scale,direction");
+            throw Py::TypeError("expected (shape,scale,direction");
         }
 
         if (!PyObject_TypeCheck(pcObjShape, &(TopoShapePy::Type))) {
@@ -308,7 +308,7 @@ class Module : public Py::ExtensionModule<Module>
     {
         PyObject *viewObj;
         if (!PyArg_ParseTuple(args.ptr(), "O", &viewObj)) {
-            throw Py::Exception("expected (DrawViewPart)");
+            throw Py::TypeError("expected (DrawViewPart)");
         } 
         Py::String dxfReturn;
 
@@ -363,7 +363,7 @@ class Module : public Py::ExtensionModule<Module>
     {
         PyObject *viewObj;
         if (!PyArg_ParseTuple(args.ptr(), "O", &viewObj)) {
-            throw Py::Exception("expected (DrawViewPart)");
+            throw Py::TypeError("expected (DrawViewPart)");
         } 
         Py::String svgReturn;
         std::string grpHead1 = "<g fill=\"none\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"";
diff --git a/src/Mod/TechDraw/App/DrawViewSymbolPyImp.cpp b/src/Mod/TechDraw/App/DrawViewSymbolPyImp.cpp
index 16ea2dff3f..1e3723fce7 100644
--- a/src/Mod/TechDraw/App/DrawViewSymbolPyImp.cpp
+++ b/src/Mod/TechDraw/App/DrawViewSymbolPyImp.cpp
@@ -43,7 +43,7 @@ PyObject* DrawViewSymbolPy::dumpSymbol(PyObject *args)
     } else {
         std::string error = std::string("Can't write ");
         error += fileSpec;
-        throw Py::Exception(error);
+        throw Py::RuntimeError(error);
     }
     Py_Return;
 }
diff --git a/src/Mod/TechDraw/Gui/AppTechDrawGuiPy.cpp b/src/Mod/TechDraw/Gui/AppTechDrawGuiPy.cpp
index 1cbf252b53..3ae34696f6 100644
--- a/src/Mod/TechDraw/Gui/AppTechDrawGuiPy.cpp
+++ b/src/Mod/TechDraw/Gui/AppTechDrawGuiPy.cpp
@@ -110,7 +110,7 @@ class Module : public Py::ExtensionModule<Module>
         PyObject *pageObj;
         char* name;
         if (!PyArg_ParseTuple(args.ptr(), "Oet", &pageObj, "utf-8",&name)) {
-            throw Py::Exception("expected (Page,path");
+            throw Py::TypeError("expected (Page,path");
         } 
         
         std::string filePath = std::string(name);
@@ -151,7 +151,7 @@ class Module : public Py::ExtensionModule<Module>
         PyObject *pageObj;
         char* name;
         if (!PyArg_ParseTuple(args.ptr(), "Oet", &pageObj, "utf-8",&name)) {
-            throw Py::Exception("expected (Page,path");
+            throw Py::TypeError("expected (Page,path");
         } 
         
         std::string filePath = std::string(name);