Stop popup cmd window

Thomas Heller theller at python.net
Fri Dec 19 11:50:18 EST 2003


Dave Benjamin <ramen at lackingtalent.com> writes:

> 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?

Several I can think of.

- untested, but you get the idea:

    try:
        main()
    except:
        import traceback
        traceback.print_exc()
        raw_input()

- set the PYTHONINSPECT env variable during runtime

- or even fire up the debugger when a problem occurs:

<http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65287>

And, by the way, py2exe 0.5 (still officially unreleased and
undocumented) created console-less programs automatically write
exceptions into a logfile.

Thomas




More information about the Python-list mailing list