Commit d59dbe68 authored by Jan Möbius's avatar Jan Möbius

Added some more debug

parent e950de59
......@@ -102,21 +102,34 @@ bool PythonInterpreter::modulesInitialized() {
}
void PythonInterpreter::initPython() {
if (Py_IsInitialized() )
if (Py_IsInitialized() ) {
#ifdef PYTHON_DEBUG
std::cerr << "Python already Initialized!" << std::endl;
#endif
return;
}
#ifdef PYTHON_DEBUG
std::cerr << "Initialize interpreter ... " ;
#endif
std::cerr << "A" << std::endl;
py::initialize_interpreter();
std::cerr << "B" << std::endl;
#ifdef PYTHON_DEBUG
std::cerr << " Done" << std::endl;
std::cerr << "Initialize Threads ...";
#endif
PyEval_InitThreads();
std::cerr << "C" << std::endl;
#ifdef PYTHON_DEBUG
std::cerr << " Done" << std::endl;
#endif
if (!modulesInitialized()) {
#ifdef PYTHON_DEBUG
std::cerr << " Import __main__" ;
std::cerr << "Import __main__" ;
#endif
//dlopen("libpython3.5m.so.1.0", RTLD_LAZY | RTLD_GLOBAL);
......@@ -124,7 +137,7 @@ void PythonInterpreter::initPython() {
#ifdef PYTHON_DEBUG
std::cerr << " Done" << std::endl;
std::cerr << " Redirect Outputs ...";
std::cerr << "Redirect Outputs ...";
#endif
// Redirect python output to integrated logger functions
......@@ -133,7 +146,7 @@ void PythonInterpreter::initPython() {
#ifdef PYTHON_DEBUG
std::cerr << " Done" << std::endl;
std::cerr << " Get __dict__ from main namespace ...";
std::cerr << "Get __dict__ from main namespace ...";
#endif
// =========================================================
......@@ -236,12 +249,19 @@ bool PythonInterpreter::runScript(QString _script) {
_script.prepend(import);
}
// init
// Try to initialize python system
try
{
std::cerr << "Run Init Python" << std::endl;
#ifdef PYTHON_DEBUG
std::cerr << "Initialize Python" << std::endl;
#endif
initPython();
std::cerr << ".. Done" << std::endl;
#ifdef PYTHON_DEBUG
std::cerr << "Done initializing Python" << std::endl;
#endif
}
catch (py::error_already_set &e)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment