From e2ec6b3574e44d1b52fb77fd2e253b2297d44259 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludger=20K=C3=BCperkoch?= Date: Wed, 15 Mar 2017 14:19:17 +0100 Subject: [PATCH] Flexible input-file naming possible now. --- pylot/core/util/utils.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pylot/core/util/utils.py b/pylot/core/util/utils.py index 8b7f8dc8..fadd2f2d 100644 --- a/pylot/core/util/utils.py +++ b/pylot/core/util/utils.py @@ -477,7 +477,7 @@ def runProgram(cmd, parameter=None): subprocess.check_output('{} | tee /dev/stderr'.format(cmd), shell=True) -def which(program): +def which(program, infile=None): """ takes a program name and returns the full path to the executable or None modified after: http://stackoverflow.com/questions/377017/test-if-executable-exists-in-python @@ -490,7 +490,12 @@ def which(program): for key in settings.allKeys(): if 'binPath' in key: os.environ['PATH'] += ':{0}'.format(settings.value(key)) - bpath = os.path.join(os.path.expanduser('~'), '.pylot', 'autoPyLoT.in') + if infile is None: + # use default parameter-file name + bpath = os.path.join(os.path.expanduser('~'), '.pylot', 'pylot.in') + else: + bpath = os.path.join(os.path.expanduser('~'), '.pylot', infile) + if os.path.exists(bpath): nllocpath = ":" + AutoPickParameter(bpath).get('nllocbin') os.environ['PATH'] += nllocpath