import subprocess import sys import os # sys.executable to use the same Python interpreter used to invoke this command if len(sys.argv) < 2: port = "8001" else: port = sys.argv[1] os.chdir("hybrid_server") subprocess.check_call([sys.executable, "-m", "sccd.compiler.sccdc", "-p", "threads", "server.xml"]) os.execv(sys.executable, [sys.executable, "run_mvk_server.py", port]) # Alternative execution modes #os.execv(sys.executable, [sys.executable, "-m", "cProfile", "-s", "tottime", "run_mvk_server.py", port])