You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
swarms/swarms/cli/run_file.py

17 lines
332 B

import sys
import subprocess
def run_file(filename: str):
"""Run a given file.
Usage: swarms run file_name.py
"""
if len(sys.argv) != 3 or sys.argv[1] != "run":
print("Usage: swarms run file_name.py")
sys.exit(1)
file_name = sys.argv[2]
subprocess.run(["python", file_name], check=True)