<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 3 October 2014 11:22, Andy Davidson <span dir="ltr"><<a href="mailto:Andy@santacruzintegration.com" target="_blank">Andy@santacruzintegration.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The subprocess  documentation suggests that you need to call communicate() and that this function will not return until the child sends EOF or terminates.</blockquote></div><br></div><div class="gmail_extra">You don't actually *need* to use communicate(), it's just advised for most cases to avoid deadlocks. If you need to e.g. read streaming data one line at a time, you can use Popen.stdout.read(). Where you need to be careful is if the process writes to both stdout and stderr, and you only read stdout, it will fill up the stderr buffer and then block trying to write more stderr, while you're waiting for output on stdout that never appears. Similarly, if you're sending it data on stdin, it can get stuck waiting for input while you're waiting for output. communicate() handles this for you, but if necessary you can handle it yourself.<br><br></div><div class="gmail_extra">Depending on your process, you might want to pipe stderr to /dev/null to discard it, or merge it with stdout so you read both at once.<br><br>Thomas<br></div></div>