How to receive the command output as it is happening in Python?
<p>I have Linux command that is running in Python.</p>

<pre><code>roc = subprocess.Popen(['sshpass', '-p', password, 'rsync', '-avz', '--info=progress2', hostname, '/home/zurelsoft/test'], 
                                    stderr=subprocess.PIPE, stdout=subprocess.PIPE).communicate()[0]
print roc
</code></pre>

<p>This print the command processing only when it finishes execution. But, I want the output of the command as it is happening and stops when the command is fully executed. How it can be done?</p>
