Hi Folks this is my first ever Python Post in any forum...
I have been busy learnin Pyhon in conjunction with PYQT4 and find it very usefull, however Ive come up against a brick wall...
What I am trying to do is capture the terminal (stdout) output of a subprocess and display it in a QTextEdit box.
The process I am interested in is an Arch Linux process called pacman.
Normally you would type in a terminal: pacman -Syy to update the central package database. The process gives a streaming text output to the terminal.
I want to capture this stream in a PyQt Gui and display it.
Any help would be great...so far I have this code:
from PyQt4 import QtGui, QtCore, uic
oldstdout = sys.stdout
sys.stdout = io.StringIO()
print("Here is some text")
#process = subprocess.Popen(['python','-h'])
process = subprocess.Popen(['pacman','-Syy'])
sys.stdout = oldstdout
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
window = MyWindow()
I get the output from the print command but the subprocess command output goes straight to the terminal....