From 7732a26c400be551cf20dfe5a0d076093471022d Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Tue, 4 Jul 2023 19:52:24 +0100 Subject: [PATCH] issue where subprocess not inheriting virtual env see SO python-subprocess-doesnt-inherit-virtual-environment --- scripts.py | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/scripts.py b/scripts.py index 0d65cf1..829d0f6 100644 --- a/scripts.py +++ b/scripts.py @@ -1,40 +1,41 @@ import subprocess +import sys from pathlib import Path def ex_dsl(): - path = Path.cwd() / "examples" / "dsl" / "." - subprocess.run(["py", str(path)]) + scriptpath = Path.cwd() / "examples" / "dsl" / "." + subprocess.run([sys.executable, str(scriptpath)]) def ex_events(): - path = Path.cwd() / "examples" / "events" / "." - subprocess.run(["py", str(path)]) + scriptpath = Path.cwd() / "examples" / "events" / "." + subprocess.run([sys.executable, str(scriptpath)]) def ex_gui(): - path = Path.cwd() / "examples" / "gui" / "." - subprocess.run(["py", str(path)]) + scriptpath = Path.cwd() / "examples" / "gui" / "." + subprocess.run([sys.executable, str(scriptpath)]) def ex_levels(): - path = Path.cwd() / "examples" / "levels" / "." - subprocess.run(["py", str(path)]) + scriptpath = Path.cwd() / "examples" / "levels" / "." + subprocess.run([sys.executable, str(scriptpath)]) def ex_midi(): - path = Path.cwd() / "examples" / "midi" / "." - subprocess.run(["py", str(path)]) + scriptpath = Path.cwd() / "examples" / "midi" / "." + subprocess.run([sys.executable, str(scriptpath)]) def ex_obs(): - path = Path.cwd() / "examples" / "obs" / "." - subprocess.run(["py", str(path)]) + scriptpath = Path.cwd() / "examples" / "obs" / "." + subprocess.run([sys.executable, str(scriptpath)]) def ex_observer(): - path = Path.cwd() / "examples" / "observer" / "." - subprocess.run(["py", str(path)]) + scriptpath = Path.cwd() / "examples" / "observer" / "." + subprocess.run([sys.executable, str(scriptpath)]) def test():