From 9034cc85bc357e10d59edc427531bee7e71d9328 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20G=C3=B3mez?= Date: Sun, 29 Sep 2024 18:16:58 -0700 Subject: [PATCH] Update remote_bootstrap.py to Python3 --- src/extra/remote_bootstrap.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/extra/remote_bootstrap.py b/src/extra/remote_bootstrap.py index a468466..2f3f349 100755 --- a/src/extra/remote_bootstrap.py +++ b/src/extra/remote_bootstrap.py @@ -29,32 +29,32 @@ import sys import os -import commands +import subprocess def main(argv): try: - commands.getoutput("cp -rf ../../../../external/DKES/* .") + subprocess.getoutput("cp -rf ../../../../external/DKES/* .") inputFile = "input.tj0" - if (not os.path.lexists("xvmec2000")): - commands.getoutput("ln -s ../../../../external/xvmec2000 xvmec2000") - #commands.getoutput ("./xvmec2000 " + inputFile) - if (not os.path.exists('wout_tj0.txt')): + if not os.path.lexists("xvmec2000"): + subprocess.getoutput("ln -s ../../../../external/xvmec2000 xvmec2000") + # subprocess.getoutput("./xvmec2000 " + inputFile) + if not os.path.exists('wout_tj0.txt'): return - if (not os.path.exists('threed1.tj0')): + if not os.path.exists('threed1.tj0'): return - commands.getoutput('mv wout_tj0.txt INPUT/wout_DAB_0.0.txt') - commands.getoutput('mv threed1.tj0 INPUT/threed1.DAB_0.0') + subprocess.getoutput('mv wout_tj0.txt INPUT/wout_DAB_0.0.txt') + subprocess.getoutput('mv threed1.tj0 INPUT/threed1.DAB_0.0') print('grep Radius INPUT/threed1.DAB_0.0 | head -2 | cut -f2 -d=| cut -f 1 -d"(" > temp.1') - commands.getoutput('grep Radius INPUT/threed1.DAB_0.0 | head -2 | cut -f2 -d=| cut -f 1 -d"(" > temp.1') - commands.getoutput('grep Radius INPUT/threed1.DAB_0.0 | head -2 | cut -f1 -d= > temp.2') - commands.getoutput('paste temp.1 temp.2 > radius.dat') + subprocess.getoutput('grep Radius INPUT/threed1.DAB_0.0 | head -2 | cut -f2 -d=| cut -f 1 -d"(" > temp.1') + subprocess.getoutput('grep Radius INPUT/threed1.DAB_0.0 | head -2 | cut -f1 -d= > temp.2') + subprocess.getoutput('paste temp.1 temp.2 > radius.dat') print("source EXE/dab.sh") - out = commands.getoutput("source EXE/dab.sh") + out = subprocess.getoutput("source EXE/dab.sh") print(out) - commands.getoutput("source EXE/recoge_res.sh") + subprocess.getoutput("source EXE/recoge_res.sh") - except Exception, e: - print("remote_bootstrap " + str(sys.exc_traceback.tb_lineno) + " " + str(e)) + except Exception as e: + print("remote_bootstrap " + str(sys.exc_info()[2].tb_lineno) + " " + str(e)) if __name__ == "__main__": main(sys.argv[1:])