Replace Python std output only for GUI application and not for CLI

This commit is contained in:
wmayer
2012-10-01 16:38:43 +02:00
parent 58da2ebbcc
commit 95de7d19cf
3 changed files with 10 additions and 3 deletions

View File

@@ -343,15 +343,20 @@ const char* InterpreterSingleton::init(int argc,char *argv[])
Py_Initialize();
PySys_SetArgv(argc, argv);
PythonStdOutput::init_type();
PythonStdOutput* out = new PythonStdOutput();
PySys_SetObject("stdout", out);
PySys_SetObject("stderr", out);
this->_global = PyEval_SaveThread();
}
return Py_GetPath();
}
void InterpreterSingleton::replaceStdOutput()
{
PyGILStateLocker locker;
PythonStdOutput* out = new PythonStdOutput();
PySys_SetObject("stdout", out);
PySys_SetObject("stderr", out);
}
int InterpreterSingleton::cleanup(void (*func)(void))
{
return Py_AtExit( func );