import sys, shutil, tempfile, os
temp_dirpath = tempfile.mkdtemp(prefix="temp_dir", dir=".")
print(os.path.exists(temp_dirpath))
print(os.listdir(os.getcwd()))
os.chdir(f"./temp_dirpath")
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), temp_dirpath))
shutil.rmtree(temp_path, ignore_errors=True)
import argparse
parser = argparse.ArgumentParser(description="演示脚本")
parser.add_argument("input", help="输入文件路径")
parser.add_argument("--num", type=int, default=0, help="设置数字")
parser.add_argument("--debug", action="store_true", help="开启调试模式")
args = parser.parse_args()
print(args.input, args.num, args.debug)
import subprocess
ret = subprocess.run(["python", "--version"], capture_output=True, text=True)
print(ret.returncode, ret.stdout, ret.stderr)