How to get stdout into a string (Python)
Question: I need to capture the stdout of a process I execute via subprocess into a
string to then put it inside a TextCtrl of a wx application I'm creating. How
do I do that?

**EDIT:** I'd also like to know how to determine when a process terminates


Answer: From the [subprocess
documentation](http://docs.python.org/library/subprocess.html#replacing-bin-
sh-shell-backquote):

    
    
    from subprocess import *
    output = Popen(["mycmd", "myarg"], stdout=PIPE).communicate()[0]
    

