Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add environment bin to $PATH when calling calwf3.e #62

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion wfc3tools/calwf3.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from __future__ import print_function

# STDLIB
import os.path
import os
import sys
import subprocess
from .version import __version_date__, __version__

Expand Down Expand Up @@ -60,10 +61,19 @@ def calwf3(input=None, output=None, printtime=False, save_tmp=False,
if output:
call_list.append(str(output))

# Prepend environment bin directory to PATH if necessary
env_bin = os.path.join(sys.exec_prefix, 'bin')
if (env_bin not in os.getenv('PATH')) & os.path.exists(env_bin):
_path = ':'.join([env_bin, os.getenv('PATH')])
else:
_path = os.getenv('PATH')

proc = subprocess.Popen(
call_list,
stderr=subprocess.STDOUT,
stdout=subprocess.PIPE,
env={'PATH':_path,
'iref':os.getenv('iref')}
)

if log_func is not None:
Expand Down