Python run system command and then exit… won't exit

前端 未结 4 878
悲&欢浪女
悲&欢浪女 2021-02-04 13:02

I have the following python code:

os.system(\"C:/Python27/python.exe C:/GUI/TestGUI.py\")
sys.exit(0)

It runs the command fine, and a window po

4条回答
  •  旧巷少年郎
    2021-02-04 13:28

    import sys ,subprocess
    
    subprocess.Popen(["C:/Python27/python.exe", "C:/GUI/TestGUI.py"])
    sys.exit(0)
    

    Popen from subprocess module what you are looking for.

提交回复
热议问题