"python.exe has stopped working" when os.execl() runs on Windows 7

Nobody nobody at nowhere.com
Sat Apr 27 23:53:25 EDT 2013


On Sat, 27 Apr 2013 17:22:31 -0700, cormogram wrote:

> Was trying os.execl() and got a "python.exe has stopped working" on my
> Windows 7 Ultimate SP1 x64 desktop.
> 
> I'm using Python 2.7.4 and that happens when the second arg is ''. For
> example:
> 
> os.execl('filename.exe','')

Note that, by convention, the second argument should normally also be the
filename (the second argument will be available to the program as
argv[0]), e.g.:

	os.execl('filename.exe','filename.exe')

If successful, the exec* functions don't return. On Unix, the new program
replaces the existing program in the current process. IIRC, the Windows
version executes the program in a child process then exit()s upon
completion.

The exec* functions probably shouldn't be used within a program which uses
any of the more complex OS features (e.g. GUI), as they will block event
processing, background threads, etc.




More information about the Python-list mailing list