communicate

Understanding Popen.communicate

Understanding Popen.communicate Question: I have a script named 1st.py which creates a REPL (read-eval-print-loop): print “Something to print” while True: r = raw_input() if r == ‘n’: print “exiting” break else: print “continuing” I then launched 1st.py with the following code: p = subprocess.Popen([“python”,”1st.py”], stdin=PIPE, stdout=PIPE) And then tried this: print p.communicate()[0] It failed, providing …

Total answers: 3

Python subprocess Popen.communicate() equivalent to Popen.stdout.read()?

Python subprocess Popen.communicate() equivalent to Popen.stdout.read()? Question: Very specific question (I hope): What are the differences between the following three codes? (I expect it to be only that the first does not wait for the child process to be finished, while the second and third ones do. But I need to be sure this is …

Total answers: 1