First page Back Continue Last page Overview Graphics

Example with execvp()

In another directory, e.g. /home/bernd/python, we have a python script execvp.py, which calls the bash script:

#!/usr/bin/python

import os

args = ("test","abc")

os.execvp("test.sh", args)

Because test.sh isn't in $PATH, there is an error message, when execvp is called in the command line.

$ ./execvp.py

Traceback (most recent call last):

File "./execvp.py", line 6, in <module>

os.execvp("test.sh", args)

File "/usr/lib/python2.6/os.py", line 344, in execvp

_execvpe(file, args)

File "/usr/lib/python2.6/os.py", line 380, in _execvpe

func(fullname, *argrest)

OSError: [Errno 2] No such file or directory