python: run external program and direct output to file and wait for finish
<p>I want to run an external program from python, redirect output (lots of text) to a log file and wait for that program to finish. I know I can do it via bash:</p>

<pre><code>#! /bin/bash
my_external_program &gt; log_file 2&gt;&amp;1
echo "done"
</code></pre>

<p>But how can I do the same with python? Note that with the bash command, I can check the log_file while the program is running. I want this property in python as well.</p>