Stop popup cmd window

Dave Benjamin ramen at lackingtalent.com
Fri Dec 19 12:53:41 EST 2003


In article <fzfg92gl.fsf at python.net>, Thomas Heller wrote:
> 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()

This is the sort of thing I usually do, but it doesn't catch syntax errors.
I wind up in this state of self-conflict, unsure if I should just run the
program again, and read really fast (which rarely works, because it always
runs faster the second time) or if I should just bite the bullet and open up
a command window. Sometimes, it takes me awhile to recover. ;)

> - set the PYTHONINSPECT env variable during runtime

I didn't even know it existed. =)

> - or even fire up the debugger when a problem occurs:
> 
><http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65287>

Cool!

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

Can py2exe produce a custom Python interpreter? Kind of like how freewrap
did this with Tcl, where your "wrapped" program could be used as an
interpreter to run other scripts in an environment of your choice?

Thanks for the info.

-- 
.:[ dave benjamin (ramenboy) -:- www.ramenfest.com -:- www.3dex.com ]:.
: d r i n k i n g   l i f e   o u t   o f   t h e   c o n t a i n e r :




More information about the Python-list mailing list