Problems with os.spawnv

kyosohma at gmail.com kyosohma at gmail.com
Thu Apr 5 17:33:23 EDT 2007


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




More information about the Python-list mailing list