Stop Python from exiting upon error in Windows

Robert at AbilitySys.com Robert at AbilitySys.com
Tue Jul 15 12:21:40 EDT 2003


Ok, I figured out the IDLE block indent (duh - RTFMenu), and now it works
great in DOS. Again, thanks to all who helped.

However, I'd still like to know how to determine what environment I'm
running under inside my code. Any suggestions?

- Robert

<Robert at AbilitySys.com> wrote in message
news:vh6v443q2fjab3 at corp.supernews.com...
> Thanks! I'm getting closer to what I want, but it raises two questions:
>
> 1. Is there an IDLE keystroke to indent a block of code? (just putting
try:
> at the start of my program causes an error, expecting an indented block to
> follow which is my entire program!)
>
> 2. Is there a way to tell the environment I'm running under (python
> interpreter, IDLE window, or other)? I'd like to put a pause at the end of
> my program if and only if I'm running under the python.exe DOS-like
> program...
>
> - Robert
>
> "Peter Hansen" <peter at engcorp.com> wrote in message
> news:3F136BEA.5B56562 at engcorp.com...
> > Tom Plunket wrote:
> > >
> > > Or- catch the error in your mainline, and do a sys.raw_input()
> > > call on exception.
> >
> > Tom meant just "raw_input()", which is a builtin, rather than
> > sys.raw_input which does not exist, of course.
> >
> > To answer your question in the other reply, yes, you can
> > nest exceptions.  If you have a try/except and the raw_input
> > in the except, however, you won't see any exception traceback
> > printed at the console so you'll need something like the
> > traceback module and one of the functions from it, like
> > traceback.print_exc().
> >
> > -Peter
>
>






More information about the Python-list mailing list