how to use pexpect to get spontaneous output of subprocess in python
This is related to my another post multithreading issue with wx.TextCtrl (or underlying GTK+) , which after correction with calling GUI interactions from primary thread, I find it again comes to the pipe block buffering problem. so How to get spontaneous output from the subprocess.stdout? To be in short, currently I am using subprocess.popen to launch an external long-time running program. launchcmd=["EXTERNAL_PROGRAM_EXE"] p = subprocess.Popen(launchcmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) self.outputThread = BashProcessThread(p.stdout.readline) self