Problems with os.spawnv

Henrik Lied henriklied at gmail.com
Thu Apr 5 17:36:28 EDT 2007


On Apr 5, 11:33 pm, kyoso... at gmail.com wrote:
> On Apr 5, 4:19 pm, "Henrik Lied" <henrikl... at gmail.com> wrote:
>
>
>
> > Hi there!
>
> > I'm trying to convert a video in a background process.
> > The scenario I'm after:
> > 1. The user uploads a video
> > 2. The video is saved in my media directory, and the database is
> > populated with the references
> > 3. The video gets converted to FLV - but the user shouldn't have to
> > wait around for this to happen
>
> > 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.
>
> I don't know what the deal is. Maybe you should try the subprocess
> module since it replaces the os.spawn* modules and do a
> subprocess.Popen instead? Or don't assign the result to a variable
> since you told it not to wait. You may need to do a combination of the
> subprocess module and one of the Threading modules.
>
> Mike

Thanks for the quick reply, Mike!

I've taken a look at the Subprocess module, but it's all a bit new to
me, if you know what I mean.
You wouldn't be able to supply me with an example, would you?

Thanks!




More information about the Python-list mailing list