Problems with os.spawnv

Klaas mike.klaas at gmail.com
Sat Apr 7 02:38:48 CEST 2007


On Apr 5, 3:25 pm, "Henrik Lied" <henrikl... at gmail.com> wrote:

> > > I'd still love to get a working example of my problem using the
> > > Subprocess module. :-)
>
> > The same thing:
> > p = subprocess.Popen(["mencoder", "/users/...", "-ofps", ...])
>
> That example looked great at first, but on a closer look it didn't
> quite end up to be what I wanted. In a real environment the user still
> had to wait for the command to finish.

Then you are not using it correctly.  subprocess.Popen() returns
immediately.  Notice the order of events here:

In [2]: subprocess.Popen('sleep 2; echo foo', shell=True); print
'bar'
bar
foo

-Mike




More information about the Python-list mailing list