while 1: try: line = raw_input() # read from stdin except EOFError: break else: ### Found = "Item found" def searcher(): try: searcher() except Found: else: ### try: except: # all uncaught exceptions come here import sys print 'uncaught!', sys.exc_info()[0], sys.exc_info()[1]