To Catch the "SystemExit" import thread from time import sleep import sys def t1(): try: i=0 while 1: print i+1 i += 1 sleep(1) except SystemExit: pass thread.start_new_thread(t1, ()) sleep(3) This Question was also asked in Python-chinese .