Commit 08e41822 authored by Nikita Sirgienko's avatar Nikita Sirgienko

[Python] Some improvments of python server code

parent 8e7e4028
......@@ -60,12 +60,13 @@ void PythonServer::runPythonCommand(const string& command)
const char* prepareCommand =
"import sys;\n"\
"class CatchOutPythonBackend:\n"\
" def __init__(self):\n"\
" def __init__(self, std_stream):\n"\
" self.value = ''\n"\
" self.encoding = std_stream.encoding\n"\
" def write(self, txt):\n"\
" self.value += txt\n"\
"outputPythonBackend = CatchOutPythonBackend()\n"\
"errorPythonBackend = CatchOutPythonBackend()\n"\
"outputPythonBackend = CatchOutPythonBackend(sys.stdout)\n"\
"errorPythonBackend = CatchOutPythonBackend(sys.stderr)\n"\
"sys.stdout = outputPythonBackend\n"\
"sys.stderr = errorPythonBackend\n";
PyRun_SimpleString(prepareCommand);
......
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