I'm following the examples at http://pythonqt.sourceforge.net/Examples.html, but PythonQt doesn't print anything on the console. I execute a script that just prints hello
, but nothing gets printed.
PythonQt::init();
PythonQtObjectPtr context = PythonQt::self()->getMainModule();
context.evalScript("print 'hello'\n");
On the other hand, if I execute it using plain python embedding it works and hello
is printed:
Py_Initialize();
PyRun_SimpleString("print 'hello'\n");
What's interesting is that if I add PythonQt::init();
before Py_Initialize();
, nothing gets printed again. So I assume PythonQt::init();
does something to python's console output. Does it redirect it somehow? How do I make it print?
I'm on Qt 4.8.6, PythonQt 2.1, and Python 2.7.6.