Keeping console window open
xuecan at gmail.com
Sun Jun 7 15:14:13 CEST 2009
2009/6/7 Fencer <no.i.dont at want.mail.from.spammers.com>
> Anyway, I wrote a few lines of code and when I first tried to run it by
> double-clicking the .py-file the console window still disappeared right
> away. So, in order to see what was happening, I ran it from a shell and it
> turned out to be a missing import. My question is how can I trap errors
> encountered by the interpreter (if that is the right way to put it) in order
> to keep the console window open so one has a chance to see the error
I don't think this (force a console window to be kept openning only for
debug purpose) is a good idea. If you just write some lines to learn
something, you may run your script in a console window or in an IDE. If you
are writing a big project, you'd better catch those exception and store logs
in some files.
However, if you still need force a console window be kept openning after the
script end, you may use module atexit.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list