Stop popup cmd window

Peter Hansen peter at engcorp.com
Tue Dec 23 10:45:21 EST 2003


Dave Benjamin wrote:
> 
> In article <mailman.272.1071697837.9307.python-list at python.org>, Fredrik Lundh wrote:
> > A console program may use the Windows API to disconnect from the
> > console, or create a window, and a window program may use the API
> > to create a console if it needs one (a version of pythonw that did this
> > if/when the application prints to sys.stderr would be quite useful, btw)
> 
> Yes! Especially if it paused afterwards, so you could actually read the
> error message! Speaking of which, is there any way to keep the console
> window on the screen after double-clicking on a .py file so that syntax
> errors don't result in a spead-reading test?

I don't remember exactly what has worked for me, but I've been able
to accomplish that (without resorting to a terminal "raw_input()" in
my script) by modifying the properties associated with the icon for the
python.exe file.  Basically, when you click on a .py, it checks what to
do in the registry.  Normally it would run c:\python23\python.exe or
whatever equivalent there is.  Under the properties for that executable
in Explorer there is a "Run" mode that can be Normal window, Minimized,
or Maximized, and just below that is a checkbox labelled "Close on exit".

I think you have to find the real .exe and not just a Shortcut to it,
though, so don't bother with whatever is in your Start menu.

And if it works for you, please post here so others will know what does
or doesn't work, as I'm unsure.

-Peter




More information about the Python-list mailing list