<br><div class="gmail_quote">2009/6/7 Fencer <span dir="ltr"><<a href="mailto:no.i.dont@want.mail.from.spammers.com">no.i.dont@want.mail.from.spammers.com</a>></span><br><div> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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 message?<br>

<br>
</blockquote></div><br>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.<br>
<br>However, if you still need force a console window be kept openning after the script end, you may use module <tt class="module">atexit.</tt><br><br>-- <br>XUE Can<br>