Newbie Question

Alex Martelli aleax at aleax.it
Tue May 6 16:41:03 EDT 2003


<posted & mailed>

Lagash wrote:

> I start to use python under Win but I have a question.
> 
> I made a little Hello World program calle HelloWorld.py
> 
> To execute it I double Clicked HelloWorld.py, but I can't see the
> result cause the dos shell close really fast
> 
> How I could block the dos shell until I press a key?

If your program is terminating normally, put as its last
statement:

    raw_input('Press Enter to close window...')

This won't help you if your program dies by propagating
an exception, however -- in that case, the dos box (with the
error traceback and message) will still close.  Unfortunately,
to deal with this you need Python statements you probably
have not yet studied, such as try/except.


Alex





More information about the Python-list mailing list