hi i have an question how can i get output from python by using QProcess.
there are one python script and QT project
i call python script from QProcess. it was done. but when i try to get output from my QProcess, i coudln`t get output. i got only Except Message from System.
my output is 'print' from python.
there are my sample code.
QT :
proc2 = new QProcess();
proc2->setWorkingDirectory("My Directory");
proc2->start("My Project");
if(proc2->waitForStarted(-1)){
while(proc2->waitForReadyRead(-1)){
QByteArray a = proc2->readAllStandardOutput();
qDebug()<<a;
}
}
qDebug()<<"Finish";
and here is my python sample Project
import sys
import os
import time
def main():
i = 0
while True:
print "test"
sys.stout.flush()
time.sleep(2)
when i run program, i coudln`t get "test" output.
but i checked if the program is runnung.
What I have tried:
connect ReadyRead Event in QT
i tried
print("")
sys.stout.write("")
print ""
at python.
when i run other my process by QProcess, i could get only Except Message.
but i coudln`t get output from 'print'