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

Neil Cerutti neilc at norwich.edu
Thu May 2 08:50:09 EDT 2013


On 2013-05-01, F?bio Santos <fabiosantosart at gmail.com> wrote:
> Reproduced in Windows 7 Ultimate:
>
>>>> import os
>>>> os.execl('ping.exe', '')
>
> At this point the REPL freezes, and windows prompts me to close Python
> since it stopped responding.

To repeat others and the documentation:

  In either case, the arguments to the child process should start
  with the name of the command being run, but this is not
  enforced.

The argument list must contain the executable as its first
argument. Python indeed crashes if I don't include the first
argument as directed.

In any case, on Windows I would normally need to do something
like this instead:

os.execlp('cmd.exe', 'cmd.exe', '/K', 'ping.exe')

-- 
Neil Cerutti



More information about the Python-list mailing list