Commit 5c26d3a3 authored by Manuel Günther's avatar Manuel Günther

Removed warning on command line when executed outside Idiap.

parent eac5be4c
...@@ -19,17 +19,18 @@ def environ(context): ...@@ -19,17 +19,18 @@ def environ(context):
# It seems that we are in a hostile environment # It seems that we are in a hostile environment
# try to source the Idiap-wide shell # try to source the Idiap-wide shell
idiap_source = "/idiap/resource/software/initfiles/shrc" idiap_source = "/idiap/resource/software/initfiles/shrc"
logger.debug("Sourcing: '%s'"%idiap_source) if os.path.exists(idiap_source):
try: logger.debug("Sourcing: '%s'"%idiap_source)
command = ['bash', '-c', 'source %s && env' % idiap_source] try:
pi = subprocess.Popen(command, stdout = subprocess.PIPE) command = ['bash', '-c', 'source %s && env' % idiap_source]
# overwrite the default environment pi = subprocess.Popen(command, stdout = subprocess.PIPE)
for line in pi.stdout: # overwrite the default environment
(key, _, value) = line.partition("=") for line in pi.stdout:
os.environ[key.strip()] = value.strip() (key, _, value) = line.partition("=")
except OSError as e: os.environ[key.strip()] = value.strip()
# occurs when the file is not executable or not found except OSError as e:
pass # occurs when the file is not executable or not found
pass
# in case the BASEDIRSETSHELL environment variable is not set, # in case the BASEDIRSETSHELL environment variable is not set,
# we are not at Idiap, # we are not at Idiap,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment