Name
execl, execle, execlp, execv, execve, execvp, execvpe
Synopsis
execl(path,*args) execle(path,*args) execlp(path,*args) execv(path,args) execve(path,args,env) execvp(path,args) execvpe(path,args,env)
These functions run the executable file (program) indicated by string
path, replacing the current program (i.e.,
the Python interpreter) in the current process. The distinctions
encoded in the function names (after the prefix
exec) control three aspects of how the new program
is found and run:
Does
pathhave to be a complete path to the program’s executable file, or can the function also accept just a name as thepathargument and search for the executable in several directories, like operating system shells do?execlp,execvp, andexecvpecan accept apathargument that is just a filename rather than a complete path. In this case, the functions search for an executable file of that name along the directories listed inos.environ['PATH']. The other functions requirepathto be a complete path to the executable file for the new program.Are arguments for the new program accepted as a single sequence argument
argsto the function or as separate arguments to the function? Functions whose names start withexecvtake a single argumentargsthat is the sequence of the arguments to use for the new program. Functions whose names start withexecltake the new program’s arguments as separate arguments (execle, in particular, uses its last argument as the environment for the new program).Is the ...