Skip to content

Commit

Permalink
improve run_python
Browse files Browse the repository at this point in the history
  • Loading branch information
BradyAJohnston committed Oct 22, 2024
1 parent e595375 commit 86aa235
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,20 @@
import bpy


def run_python(args: str):
def run_python(args: str | List[str]):
python = os.path.realpath(sys.executable)
subprocess.run([python] + args.split(" "))

if isinstance(args, str):
args = [python] + args.split(" ")
elif isinstance(args, list):
args = [python] + args
else:
raise ValueError(
"Arguments must be a string to split into individual arguments by space"
"or a list of individual arguments already split"
)

subprocess.run(args)


try:
Expand Down

0 comments on commit 86aa235

Please sign in to comment.