Problem using execvp

Hans Mulder hansmu at xs4all.nl
Thu Oct 27 05:27:04 EDT 2011


On 27/10/11 10:57:55, faucheuse wrote:
> I'm trying to launch my python program with another process name than
> "python.exe".

Which version of Python are you using?
Which version of which operating system?

> In order to do that I'm trying to use the os.execvp function :
>
> os.execvp("./Launch.py", ["ProcessName"])
>
> Launch.py is the file that Launch the program and ProcessName is
> the ... Process Name ^^
>
> I get this error : OSError : [Errno 8] Exec format error.

Maybe ./Lauch.py is not executable.....

Can you run ./Launch.py from the command line?
Does it have a valid shebang line?
Is the 'x' bit set?
What does "file ./Launch.py" report?

> I searched and found many solutions like : os.execvp("./Launch.py",
> ["./Launch.py","ProcessName"]), but nothing worked so far.

This works for me:

     os.execvp("./Launch.py", ["ProcessName"]])


-- HansM



More information about the Python-list mailing list