diff --git a/src/Mod/Fem/Gui/AppFemGui.cpp b/src/Mod/Fem/Gui/AppFemGui.cpp index e29c17124..425f86328 100644 --- a/src/Mod/Fem/Gui/AppFemGui.cpp +++ b/src/Mod/Fem/Gui/AppFemGui.cpp @@ -68,7 +68,7 @@ extern struct PyMethodDef FemGui_Import_methods[]; /* Python entry */ extern "C" { -void FemGuiExport initFemGui() +void FemGuiExport initFemGui() { if (!Gui::Application::Instance) { PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application."); @@ -102,19 +102,25 @@ void FemGuiExport initFemGui() FemGui::ViewProviderResult ::init(); FemGui::ViewProviderResultPython ::init(); - Base::Interpreter().loadModule("FemCommands"); + try { + Base::Interpreter().loadModule("FemCommands"); - Base::Interpreter().loadModule("_CommandMechanicalShowResult"); - Base::Interpreter().loadModule("_CommandQuickAnalysis"); - Base::Interpreter().loadModule("_CommandPurgeFemResults"); - Base::Interpreter().loadModule("_CommandMechanicalJobControl"); - Base::Interpreter().loadModule("_CommandFemFromShape"); - Base::Interpreter().loadModule("_CommandNewMechanicalAnalysis"); + Base::Interpreter().loadModule("_CommandMechanicalShowResult"); + Base::Interpreter().loadModule("_CommandQuickAnalysis"); + Base::Interpreter().loadModule("_CommandPurgeFemResults"); + Base::Interpreter().loadModule("_CommandMechanicalJobControl"); + Base::Interpreter().loadModule("_CommandFemFromShape"); + Base::Interpreter().loadModule("_CommandNewMechanicalAnalysis"); - Base::Interpreter().loadModule("MechanicalAnalysis"); - Base::Interpreter().loadModule("MechanicalMaterial"); - Base::Interpreter().loadModule("FemBeamSection"); - Base::Interpreter().loadModule("FemShellThickness"); + Base::Interpreter().loadModule("MechanicalAnalysis"); + Base::Interpreter().loadModule("MechanicalMaterial"); + Base::Interpreter().loadModule("FemBeamSection"); + Base::Interpreter().loadModule("FemShellThickness"); + } + catch (const Base::Exception& e) { + PyErr_SetString(PyExc_ImportError, e.what()); + return; + } // register preferences pages new Gui::PrefPageProducer ("FEM");