Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #44456 > unrolled thread

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

Started bycormogram@gmail.com
First post2013-04-27 17:22 -0700
Last post2013-04-27 22:06 -0700
Articles 15 — 6 participants

Back to article view | Back to comp.lang.python


Contents

  "python.exe has stopped working" when os.execl() runs on Windows 7 cormogram@gmail.com - 2013-04-27 17:22 -0700
    Re: "python.exe has stopped working" when os.execl() runs on Windows 7 Dave Angel <davea@davea.name> - 2013-04-27 20:55 -0400
      Re: "python.exe has stopped working" when os.execl() runs on Windows 7 cormogram@gmail.com - 2013-04-27 18:05 -0700
        Re: "python.exe has stopped working" when os.execl() runs on Windows 7 Dave Angel <davea@davea.name> - 2013-04-27 22:02 -0400
          Re: "python.exe has stopped working" when os.execl() runs on Windows 7 cormogram@gmail.com - 2013-04-27 20:42 -0700
            Re: "python.exe has stopped working" when os.execl() runs on Windows 7 Terry Jan Reedy <tjreedy@udel.edu> - 2013-04-28 03:51 -0400
              Re: "python.exe has stopped working" when os.execl() runs on Windows 7 cormogram@gmail.com - 2013-04-28 18:39 -0700
            Re: "python.exe has stopped working" when os.execl() runs on Windows 7 Fábio Santos <fabiosantosart@gmail.com> - 2013-04-28 09:02 +0100
              Re: "python.exe has stopped working" when os.execl() runs on Windows 7 cormogram@gmail.com - 2013-04-28 18:34 -0700
            Re: "python.exe has stopped working" when os.execl() runs on Windows 7 Fábio Santos <fabiosantosart@gmail.com> - 2013-04-28 09:05 +0100
              Re: "python.exe has stopped working" when os.execl() runs on Windows 7 cormogram@gmail.com - 2013-04-28 18:38 -0700
                Re: "python.exe has stopped working" when os.execl() runs on Windows 7 Fábio Santos <fabiosantosart@gmail.com> - 2013-05-01 22:00 +0100
                  Re: "python.exe has stopped working" when os.execl() runs on Windows 7 Neil Cerutti <neilc@norwich.edu> - 2013-05-02 12:50 +0000
    Re: "python.exe has stopped working" when os.execl() runs on Windows 7 Nobody <nobody@nowhere.com> - 2013-04-28 04:53 +0100
      Re: "python.exe has stopped working" when os.execl() runs on Windows 7 cormogram@gmail.com - 2013-04-27 22:06 -0700

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

Fromcormogram@gmail.com
Date2013-04-27 17:22 -0700
Subject"python.exe has stopped working" when os.execl() runs on Windows 7
Message-ID<2e11de8b-f7e1-407f-a2fd-a08d5ce55d0b@googlegroups.com>
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','')


Wtf? :(

http://postimg.org/image/vdliyuenh/

[toc] | [next] | [standalone]


#44457

FromDave Angel <davea@davea.name>
Date2013-04-27 20:55 -0400
Message-ID<mailman.1131.1367110561.3114.python-list@python.org>
In reply to#44456
On 04/27/2013 08:22 PM, cormogram@gmail.com 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','')
>
>
> Wtf? :(
>
> http://postimg.org/image/vdliyuenh/
>

Do you really have a program called  filename.exe ?

Are you by any chance running this inside some shell or debugger, like 
IDLE or KOMODO?  Or is it a GUI program ?  More specifically, does it 
still give an error like that if you have a two-line Python program:
    import os
    os.execl('filename.exe', '')

execl is supposed to replace the current (python) program, with the 
filename.exe one.  But if the current program has any OS resources in 
use (like file objects), they don't get flushed/released.

The execl was intended for use on Unix, and Windows can't really do what 
it's documented to do.

If you don't get any useful answers here, I'd suggest going to 
multiprocess module.

-- 
DaveA

[toc] | [prev] | [next] | [standalone]


#44458

Fromcormogram@gmail.com
Date2013-04-27 18:05 -0700
Message-ID<b53733c1-7d3f-47dd-bc6d-7f33fa91aa78@googlegroups.com>
In reply to#44457
Yes, just those two lines cause the error. 'filename.exe' exists and runs ok in the command prompt. Any other executable cause the problem, also '', for example:

os.execl('','')

If doesn't work on Windows it should give an error message, right?

On Saturday, April 27, 2013 9:55:34 PM UTC-3, Dave Angel wrote:
> On 04/27/2013 08:22 PM, cormogram@gmail.com 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','')
> 
> >
> 
> >
> 
> > Wtf? :(
> 
> >
> 
> > http://postimg.org/image/vdliyuenh/
> 
> >
> 
> 
> 
> Do you really have a program called  filename.exe ?
> 
> 
> 
> Are you by any chance running this inside some shell or debugger, like 
> 
> IDLE or KOMODO?  Or is it a GUI program ?  More specifically, does it 
> 
> still give an error like that if you have a two-line Python program:
> 
>     import os
> 
>     os.execl('filename.exe', '')
> 
> 
> 
> execl is supposed to replace the current (python) program, with the 
> 
> filename.exe one.  But if the current program has any OS resources in 
> 
> use (like file objects), they don't get flushed/released.
> 
> 
> 
> The execl was intended for use on Unix, and Windows can't really do what 
> 
> it's documented to do.
> 
> 
> 
> If you don't get any useful answers here, I'd suggest going to 
> 
> multiprocess module.
> 
> 
> 
> -- 
> 
> DaveA

[toc] | [prev] | [next] | [standalone]


#44459

FromDave Angel <davea@davea.name>
Date2013-04-27 22:02 -0400
Message-ID<mailman.1132.1367114541.3114.python-list@python.org>
In reply to#44458
On 04/27/2013 09:05 PM, cormogram@gmail.com wrote:
> Yes, just those two lines cause the error. 'filename.exe' exists and runs ok in the command prompt. Any other executable cause the problem, also '', for example:
>
> os.execl('','')
>
> If doesn't work on Windows it should give an error message, right?
>

I'm not running Windows any more, so it's hard to be conclusive.  When I 
saw the description, I just assumed it'd be problematic under Windows. 
That's why I had never played with it.  By the time I escaped to Linux, 
I was used to subprocess, so I still never played with execl.  But why 
you should get that error on a console program run from the cmd prompt, 
I have no idea.


-- 
DaveA

[toc] | [prev] | [next] | [standalone]


#44460

Fromcormogram@gmail.com
Date2013-04-27 20:42 -0700
Message-ID<9ac24332-ead8-4889-815a-a12052f43742@googlegroups.com>
In reply to#44459
Probably a bug I suppose. :(

I've used subprocess before and it works fine. I was just learning about the os module. os.execl() works if you provide no nulls, for example:

os.execl('c:\\bin\\filename.exe','filename.exe','arg1')

Is there the place to open a ticket for Python developers? Who keeps the os module?

On Saturday, April 27, 2013 11:02:01 PM UTC-3, Dave Angel wrote:
> On 04/27/2013 09:05 PM, cormogram@gmail.com wrote:
> 
> > Yes, just those two lines cause the error. 'filename.exe' exists and runs ok in the command prompt. Any other executable cause the problem, also '', for example:
> 
> >
> 
> > os.execl('','')
> 
> >
> 
> > If doesn't work on Windows it should give an error message, right?
> 
> >
> 
> 
> 
> I'm not running Windows any more, so it's hard to be conclusive.  When I 
> 
> saw the description, I just assumed it'd be problematic under Windows. 
> 
> That's why I had never played with it.  By the time I escaped to Linux, 
> 
> I was used to subprocess, so I still never played with execl.  But why 
> 
> you should get that error on a console program run from the cmd prompt, 
> 
> I have no idea.
> 
> 
> 
> 
> 
> -- 
> 
> DaveA

[toc] | [prev] | [next] | [standalone]


#44465

FromTerry Jan Reedy <tjreedy@udel.edu>
Date2013-04-28 03:51 -0400
Message-ID<mailman.1134.1367135455.3114.python-list@python.org>
In reply to#44460
On 4/27/2013 11:42 PM, cormogram@gmail.com wrote:

> Is there the place to open a ticket for Python developers?

bugs.python.org

[toc] | [prev] | [next] | [standalone]


#44484

Fromcormogram@gmail.com
Date2013-04-28 18:39 -0700
Message-ID<3d723b60-8f76-46d0-8a66-f0dd8b95d40e@googlegroups.com>
In reply to#44465
Thank you!

On Sunday, April 28, 2013 4:51:03 AM UTC-3, Terry Jan Reedy wrote:
> On 4/27/2013 11:42 PM, cormogram@gmail.com wrote:
> 
> 
> 
> > Is there the place to open a ticket for Python developers?
> 
> 
> 
> bugs.python.org

[toc] | [prev] | [next] | [standalone]


#44466

FromFábio Santos <fabiosantosart@gmail.com>
Date2013-04-28 09:02 +0100
Message-ID<mailman.1135.1367136176.3114.python-list@python.org>
In reply to#44460
Cannot reproduce on windows 7 ultimate

Steps taken:

Start cmd
cd to Desktop where I have a GUI application
run python on the console
import os
os.execl('exe.exe', 'exe.exe')

<python stops at this point and starts GUI application as expected>


On Sun, Apr 28, 2013 at 8:51 AM, Terry Jan Reedy <tjreedy@udel.edu> wrote:
> On 4/27/2013 11:42 PM, cormogram@gmail.com wrote:
>
>> Is there the place to open a ticket for Python developers?
>
>
> bugs.python.org
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list



-- 
Fábio Santos

[toc] | [prev] | [next] | [standalone]


#44482

Fromcormogram@gmail.com
Date2013-04-28 18:34 -0700
Message-ID<7dd42af2-52b9-4fcc-8fc7-c5ad7a53dd91@googlegroups.com>
In reply to#44466
It works fine as long as you don't provide a null string ('') to os.execl(), such as:

os.execl('filename.exe','')
 
On Sunday, April 28, 2013 5:02:48 AM UTC-3, Fábio Santos wrote:
> Cannot reproduce on windows 7 ultimate
> 
> 
> 
> Steps taken:
> 
> 
> 
> Start cmd
> 
> cd to Desktop where I have a GUI application
> 
> run python on the console
> 
> import os
> 
> os.execl('exe.exe', 'exe.exe')
> 
> 
> 
> <python stops at this point and starts GUI application as expected>
> 
> 
> 
> 
> 
> On Sun, Apr 28, 2013 at 8:51 AM, Terry Jan Reedy <tjreedy@udel.edu> wrote:
> 
> > On 4/27/2013 11:42 PM, cormogram@gmail.com wrote:
> 
> >
> 
> >> Is there the place to open a ticket for Python developers?
> 
> >
> 
> >
> 
> > bugs.python.org
> 
> >
> 
> >
> 
> > --
> 
> > http://mail.python.org/mailman/listinfo/python-list
> 
> 
> 
> 
> 
> 
> 
> -- 
> 
> Fábio Santos

[toc] | [prev] | [next] | [standalone]


#44467

FromFábio Santos <fabiosantosart@gmail.com>
Date2013-04-28 09:05 +0100
Message-ID<mailman.1136.1367136310.3114.python-list@python.org>
In reply to#44460
Is this executable freely available, or something you can share? If
you can send me that executable I can try to reproduce the bug with
it.

[toc] | [prev] | [next] | [standalone]


#44483

Fromcormogram@gmail.com
Date2013-04-28 18:38 -0700
Message-ID<0d9d14dc-877b-4b68-aefe-834b530dee2c@googlegroups.com>
In reply to#44467
It isn't, but it doesn't matter because all executables I've tried cause the error, even "ping.exe". Just try:

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

And it will cause the "python.exe has stopped working" error message.

On Sunday, April 28, 2013 5:05:02 AM UTC-3, Fábio Santos wrote:
> Is this executable freely available, or something you can share? If
> 
> you can send me that executable I can try to reproduce the bug with
> 
> it.

[toc] | [prev] | [next] | [standalone]


#44602

FromFábio Santos <fabiosantosart@gmail.com>
Date2013-05-01 22:00 +0100
Message-ID<mailman.1223.1367442043.3114.python-list@python.org>
In reply to#44483
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.


--
Fábio Santos

[toc] | [prev] | [next] | [standalone]


#44619

FromNeil Cerutti <neilc@norwich.edu>
Date2013-05-02 12:50 +0000
Message-ID<auf5o1Fovg8U1@mid.individual.net>
In reply to#44602
On 2013-05-01, F?bio Santos <fabiosantosart@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

[toc] | [prev] | [next] | [standalone]


#44461

FromNobody <nobody@nowhere.com>
Date2013-04-28 04:53 +0100
Message-ID<pan.2013.04.28.03.53.25.536000@nowhere.com>
In reply to#44456
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.

[toc] | [prev] | [next] | [standalone]


#44463

Fromcormogram@gmail.com
Date2013-04-27 22:06 -0700
Message-ID<d2c227b9-7536-4ab3-827a-b8953fca41ba@googlegroups.com>
In reply to#44461
I did that but unfortunately the 'bug' persists. :(

I've chosen the os module because I though it would be more portable. :/

On Sunday, April 28, 2013 12:53:25 AM UTC-3, Nobody wrote:
> 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.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web