Keeping console window open

Fencer no.i.dont at want.mail.from.spammers.com
Sun Jun 7 09:39:50 EDT 2009


Scott David Daniels wrote:
> To be a trifle more explicit, turn:
> 
>       ...
>       if __name__ == '__main__':
>          main()
> 
> into:
>       ...
>       if __name__ == '__main__':
>          try:
>              main()
>          except Exception, why:
>              print 'Failed:', why
>              import sys, traceback
>              traceback.print_tb(sys.exc_info()[2])
>          raw_input('Leaving: ')
> 
> Note that building your script like this also allows you to
> open the interpretter, and type:
>     import mymodule
>     mymodule.main()
> in order to examine how it runs.

Thanks alot, this was exactly what I was looking for!

> 
> --Scott David Daniels
> Scott.Daniels at Acm.Org



More information about the Python-list mailing list