os.execv Overhead

mark.mcdowall at gmail.com mark.mcdowall at gmail.com
Wed Sep 16 11:12:50 EDT 2009


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.

Any comments would be greatfully appreciated.



More information about the Python-list mailing list