Starting an external, independent process from a script

rishi pathak mailmaverick666 at gmail.com
Tue Mar 13 05:57:33 EDT 2007


You can do something like this:
pid = os.fork()
if pid != 0:
    os.execl("mencoder variables here and its arguments")
else:
    continue
exec will replace the current child process with the given command and as we
are doing fork the command will get executed in a child process.You can also
use os.system there

On 12 Mar 2007 16:13:51 -0700, Henrik Lied <henriklied at gmail.com> wrote:
>
> Hi there!
>
> I'm trying to create a video uploading service (just to learn). The
> system is mostly based on Django, but the question I'm looking an
> answer for is more related to Python.
>
> So, the user gets to upload a video file. This can either be a mpg,
> avi or mp4-file. When the file is saved to its location, I want to
> convert it to FLA (Flash Video). I'm currently using Mplayers
> Mencoder, and this works great. The Mencoder is retrieved through
> running os.system("mencoder variables here")
>
> The problem with this is that the user has to wait until the movie is
> done encoding until he can go around with his business. I don't look
> upon this as ideal.
>
> So - I want to spawn a new system process. I need some good pointers
> on how to do this right.
>
> Any input? :-)
>
> Thanks a lot in advance!
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Regards--
Rishi Pathak
National PARAM Supercomputing Facility
Center for Development of Advanced Computing(C-DAC)
Pune University Campus,Ganesh Khind Road
Pune-Maharastra
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070313/4a098284/attachment.html>


More information about the Python-list mailing list