import subprocess import traceback from threading import Thread p = subprocess.Popen('pause', shell=True) # uncomment below statment make bug disappear p2 = subprocess.Popen('pause', shell=True) def f(): p.wait() print('thread exit') t = Thread(target=f) t.start() try: print('1st join') print("PLEASE PRESS CTRL-C TWICE, IGNORE THE 'Press any key to continue'") t.join() # subprocess.Popen() makes join() can be interrupted except: traceback.print_exc() print('2nd join') t.join() # stuck here!!! print('done')