Problems with os.spawnv

Henrik Lied henriklied at gmail.com
Thu Apr 5 17:53:04 EDT 2007


On Apr 5, 11:39 pm, "Gabriel Genellina" <gagsl-... at yahoo.com.ar>
wrote:
> En Thu, 05 Apr 2007 18:19:56 -0300, Henrik Lied <henrikl... at gmail.com>
> escribió:
>
> > So, I thought to myself that spawnv would be a good fit for this. The
> > problem is that it doesn't fire of the command.
>
> > Here's my test script:http://dpaste.com/hold/7981/
>
> > Why won't this work? The while-loop is printed, but the os command
> > isn't executed. I've also tried to specify the whole path to mencoder
> > (/opt/local/bin/mencoder), but to no use.
>
> You are using:
>      v = os.spawnv(os.P_NOWAIT, "mencoder", "/Users/henriklied/test.mov
> -ofps 25 -o test.flv ...")
>
> Read the docs about the spawnv function:  http://docs.python.org/lib/os-process.html#l2h-2749
>
> In particular "...The "v" variants are good when the number of parameters
> is variable, with the arguments being passed in a list or tuple as the
> args parameter. In either case, the arguments to the child process must
> start with the name of the command being run."
>
> So, for spawnv, you should build a list with each argument as an item,
> being "mencoder" the first item.
> But in your case it's a lot easier to use spawnl:
>
>      v = os.spawnl(os.P_NOWAIT, "mencoder", "mencoder",
> "/Users/henriklied/test.mov", "-ofps", "25", "-o", "...")
>
> --
> Gabriel Genellina

Hi Gabriel,

Thanks for your reply - but I'm afraid to tell you that spawnl didn't
do the trick either.
Here's the full command I used: http://dpaste.com/hold/7982/

I'd still love to get a working example of my problem using the
Subprocess module. :-)




More information about the Python-list mailing list