Python - capture Popen stdout AND display on console?

后端 未结 5 1269
猫巷女王i
猫巷女王i 2020-12-17 02:51

I want to capture stdout from a long-ish running process started via subprocess.Popen(...) so I\'m using stdout=PIPE as an arg.

However, be

5条回答
  •  渐次进展
    2020-12-17 03:46

    S. Lott's comment points to Getting realtime output using subprocess and Real-time intercepting of stdout from another process in Python

    I'm curious that Alex's answer here is different from his answer 1085071. My simple little experiments with the answers in the two other referenced questions has given good results...

    I went and looked at wexpect as per Alex's answer above, but I have to say reading the comments in the code I was not left a very good feeling about using it.

    I guess the meta-question here is when will pexpect/wexpect be one of the Included Batteries?

提交回复
热议问题