From 6b19dd03bb84c6f7542746cde2c682c8b0aa6207 Mon Sep 17 00:00:00 2001 From: Fidel Alfaro Almagro <falmagro@fmrib.ox.ac.uk> Date: Fri, 10 Feb 2023 09:21:54 +0000 Subject: [PATCH] Changing the env variable modification for FreeSurfer --- bip/pipelines/struct_FS/FS_proc.py | 4 ++-- bip/utils/log_utils.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bip/pipelines/struct_FS/FS_proc.py b/bip/pipelines/struct_FS/FS_proc.py index 1a72558..4022122 100755 --- a/bip/pipelines/struct_FS/FS_proc.py +++ b/bip/pipelines/struct_FS/FS_proc.py @@ -31,7 +31,7 @@ def run(ctx, if os.path.exists(FreeSurfer_dir): shutil.rmtree(FreeSurfer_dir) - subjects_dir=os.getcwd() + env = dict(os.environ, SUBJECTS_DIR=os.getcwd()) os.environ["SUBJECTS_DIR"] = subjects_dir + "/" + ctx.subject T1_path = subjects_dir + "/" + T1_unbiased @@ -42,7 +42,7 @@ def run(ctx, if os.path.exists(T2_FLAIR_unbiased): cmd += " -FLAIR " + T2_path + " -FLAIRpial" - output = run_command(log, cmd) + output = run_command(log, cmd, env) log.info(output) diff --git a/bip/utils/log_utils.py b/bip/utils/log_utils.py index abcc870..d40dd90 100755 --- a/bip/utils/log_utils.py +++ b/bip/utils/log_utils.py @@ -22,10 +22,10 @@ from subprocess import check_output from fsl import wrappers -def run_command(logger, command): +def run_command(logger, command, env): try: logger.info('COMMAND TO RUN: \t' + command.strip()) - job_output = check_output(command, shell=True).decode('UTF-8') + job_output = check_output(command, shell=True, env=env).decode('UTF-8') logger.info('COMMAND OUTPUT: \t' + job_output.strip()) except Exception as e: logger.error('Exception raised during: \t' + command.strip()) -- GitLab