diff --git a/src/Main/FreeCADGuiPy.cpp b/src/Main/FreeCADGuiPy.cpp index 43ee6e8c6..ab5320e37 100644 --- a/src/Main/FreeCADGuiPy.cpp +++ b/src/Main/FreeCADGuiPy.cpp @@ -240,6 +240,7 @@ QWidget* setupMainWindow() } if (!Gui::MainWindow::getInstance()) { + PyObject* input = PySys_GetObject("stdin"); Gui::MainWindow *mw = new Gui::MainWindow(); QIcon icon = qApp->windowIcon(); if (icon.isNull()) @@ -288,6 +289,7 @@ QWidget* setupMainWindow() Gui::Application::Instance->activateWorkbench(start.c_str()); mw->loadWindowSettings(); + PySys_SetObject("stdin", input); } else { Gui::getMainWindow()->show(); diff --git a/src/Main/MainPy.cpp b/src/Main/MainPy.cpp index 0317fb9d4..e2ebb537e 100644 --- a/src/Main/MainPy.cpp +++ b/src/Main/MainPy.cpp @@ -46,6 +46,7 @@ // FreeCAD Base header #include +#include #include @@ -112,6 +113,8 @@ extern "C" strncpy(argv[0],szFileName,MAX_PATH); argv[0][MAX_PATH-1] = '\0'; // ensure null termination #elif defined(FC_OS_LINUX) + putenv("LANG=C"); + putenv("LC_ALL=C"); // get whole path of the library Dl_info info; int ret = dladdr((void*)initFreeCAD, &info); @@ -123,6 +126,9 @@ extern "C" argv[0] = (char*)malloc(PATH_MAX); strncpy(argv[0], info.dli_fname,PATH_MAX); argv[0][PATH_MAX-1] = '\0'; // ensure null termination + // this is a workaround to avoid a crash in libuuid.so + Base::Uuid uuid; + uuid.UuidStr=""; #elif defined(FC_OS_MACOSX) uint32_t sz = 0; char *buf;