First page Back Continue Last page Overview Image

Beispiel mit execvp()

In einem anderen Verzeichnis, z.B. /home/bernd/python, haben wir ein Python-Skript execvp.py, dass dieses Bash-Skript aufruft:

#!/usr/bin/python

import os

args = ("test","abc")

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

Da test.sh nicht in $PATH ist, gibt es eine Fehlermeldung, wenn man execvp in der Kommandozeile aufruft:

$ ./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