[Tutor] Can you help me with subprocess module ?.
Larry Riedel
Larry at Riedel.org
Wed Feb 4 02:54:24 CET 2009
> I have a problem with the subprocess module. In fact I wish
> that when I run the command with subprocess I can retrieve the
> data immediately without waiting for the end of the command.
>
> import subprocess, os, sys
> # Commande FFmpeg
> com_1 = 'ffmpeg -i /home/user/path/in.avi -s 160x120 -ac 1
> -ar 22050 -qmin 3 -qmax 3 -y /home/user/path/out.avi'
> p = [subprocess.Popen(com_1, stderr=subprocess.STDOUT,
> stdout=subprocess.PIPE, shell=True).communicate()[0]]
The "communicate" method waits for the process to exit.
Maybe look farther down the page for "Replacing os.popen"
http://docs.python.org/library/subprocess.html
Larry
More information about the Tutor
mailing list