import os
import sys
os.execl(sys.executable, sys.executable, *sys.argv)
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)
def restart():
import sys
print("argv was",sys.argv)
print("sys.executable was", sys.executable)
print("restart now")
import os
os.execv(sys.executable, ['python'] + sys.argv)