From 9223c05112497b3d6b566c78bceb2dd42dc4dfef Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 2 Nov 2023 16:51:56 -0400 Subject: [PATCH] fix(subprocess): Overwrite PYTHONHOME variable to it works on Rhino 8 --- lbt_recipes/recipe.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lbt_recipes/recipe.py b/lbt_recipes/recipe.py index 39eb0c94..4c189840 100644 --- a/lbt_recipes/recipe.py +++ b/lbt_recipes/recipe.py @@ -310,14 +310,18 @@ def run(self, settings=None, radiance_check=False, openstudio_check=False, # execute command shell = False if os.name == 'nt' and not silent else True + custom_env = os.environ.copy() + custom_env['PYTHONHOME'] = '' if settings.report_out: process = subprocess.Popen( - command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=shell) + command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, + shell=shell, env=custom_env + ) result = process.communicate() print(result[0]) print(result[1]) else: - process = subprocess.Popen(command, shell=shell) + process = subprocess.Popen(command, shell=shell, env=custom_env) result = process.communicate() # freeze the canvas while running return folder