Windows/DOS: double clicking a .py file

Thomas Heller theller at python.net
Mon Sep 9 17:18:53 CEST 2002


"Just" <just at xs4all.nl> wrote in message news:just-A936EC.17062909092002 at news1.xs4all.nl...
> 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:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65287
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.

Thomas





More information about the Python-list mailing list