sys.stdout.flush() os.execl(sys.executable, 'python', __file__, *sys.argv[1:])
import os while 1: os.system("python main.py") print "Restarting..." exit()
os.execv(sys.executable, ['python'] + sys.argv)