Handle Exceptions in main & Pythoninit (#601)

This commit is contained in:
LordGrey
2019-08-15 23:49:32 +02:00
committed by brindosch
parent 7e295a715f
commit c4d0edd9c2
2 changed files with 29 additions and 19 deletions

View File

@@ -19,6 +19,11 @@ PythonInit::PythonInit()
// init Python
Debug(Logger::getInstance("DAEMON"), "Initializing Python interpreter");
Py_InitializeEx(0);
if ( !Py_IsInitialized() )
{
throw std::runtime_error("Initializing Python failed!");
}
PyEval_InitThreads(); // Create the GIL
mainThreadState = PyEval_SaveThread();
}