Windows/DOS: double clicking a .py file

Just just at
Mon Sep 9 11:42:56 EDT 2002

In article <alie4t$1q4jol$1 at>,
 "Thomas Heller" <theller at> wrote:

> "Just" <just at> wrote in message 
> news:just-A936EC.17062909092002 at
> > Sorry if this is a Windows FAQ, I'm a newbie to Windows, but not to
> > Python.
> >
> > If I double-click a Python script (or use the start command in the dos
> > prompt) a new dos prompt window is opened and my program is run. The
> > window goes away when the program is done. However, the window _also_
> > goes away when the program raises an exception, making it virtually
> > impossible to actually _see_ the exception... Is there a way to keep the
> > dos prompt window in this case?
> One solution is outlined here:
> This is useful for the development machine. It keeps the DOS window
> open, and leaves you in the Python debugger, where you can play around
> even more to find out about the state of your program.
> >
> > A py2exe-fied version of the program shows the same behavior, which
> > leads my users to report problems like "the output file is mysteriously
> > truncated" instead of "I'm getting a traceback. Here, have a look."...
> >
> > Any suggestions?
> For py2exe-packages apps you should redirect sys.stdout and sys.stderr
> into a log-file.

Thanks for both suggestions. Another workaround just occured to me: do a 
raw_input("type enter to exit") in an exception hook. That should work 
just fine in a py2exe-fied app as well I suppose.


More information about the Python-list mailing list