Mage wrote: > def error_msg(msg): > sys.exit(msg) > > try: > do_something() > if value != my_wish: > error_msg('Invalid input') > except: > print "Fatal IO or Network error" > > This doesn't work because sys.exit raises an exception. > > I know that I can define exception types after except, but there might > be many. Also I know I can write: > except: > if str(sys.exc_info()[0]) == 'exceptions.SystemExit': > raise > > But honestly I would like simething like that: > > except (!SystemExit): > > Is this possible somehow?
try: # may raise any exception except SystemExit: raise # propagate SystemExit (and subclasses) except: # handle everything else Peter -- http://mail.python.org/mailman/listinfo/python-list