On Wed, 16 Sep 2009 08:12:50 -0700, mark.mcdow...@gmail.com wrote:

> I have a script that automates running a program X times by preparing
> the required files and passing the external program right variables.
> 
> What I am unsure about though is the overhead of:
> 
>       program  = "externalScript"
>       variables = ["-i", "var1"]
>       pid = os.fork()
>       if not pid:
>               os.execv(program, [program] + variables)
>       os.wait()
> 
> Whether there would be a more efficient way of making such a call.

I would expect the overhead to be dominated by the underlying fork() and
execve() system calls, rather than anything within Python.

OTOH, using subprocess.call() wouldn't be any slower, and is more portable.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to