ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> activepython
activepython
Re: keep console window after double-click foo.py
by Trent Mick other posts by this author
Mar 22 2007 2:28PM messages near this date
view in the new Beta List Site
Re: keep console window after double-click foo.py | Re: keep console window after double-click foo.py
>  I'd like the window to stick around if there are any exceptions
>  raised.  I tried to put all my code in function main() and use
>  
>  try:
>      main()
>  except None:
>      raise
>  else:
>      print "Press RETURN to exit..."
>      sys.stdin.readline()
>  
>  No dice: the window closes even if main() raises an exception.  
>  Any idea how to do it?

Try this:

try:
     main()
except:
     import traceback
     print "The script crashed:"
     traceback.print_exc()
     print "Press RETURN to exit..."
     sys.stdin.readline()


Trent

-- 
Trent Mick
trentm at activestate.com
_______________________________________________
ActivePython mailing list
ActivePython@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython
Thread:
smr
Fra Mue
Trent Mick
smr

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved