I'm trying to invoke a command line utility from Python. The code is as follows
import subprocess import sys class Executor : def executeEXE(self,executable ) : CREATE_NO_WINDOW = 0x08000000 process = subprocess.Popen(executable, stdout=subprocess.PIPE, creationflags=CREATE_NO_WINDOW ) while True: line = process.stdout.readline() if line == '' and process.poll() != None: break print line The problem with above code is I want the real-time output of above process which I'm not getting. What I'm doing wrong here.
subprocess.popen()output is echoed in this answer might be helpful.iter()-based loop instead of thewhile-loop.readline()statement is somehow not returning the output. I'm not sure howiter()will help. And yes I'm on Windows.