From 57d21c8383888a66026787128bd2fde5ccb20009 Mon Sep 17 00:00:00 2001 From: volaya Date: Wed, 20 May 2015 06:15:42 +0200 Subject: [PATCH] [processing] swallow possible exceptions when reading console output from SAGA --- .../plugins/processing/algs/saga/SagaUtils.py | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/python/plugins/processing/algs/saga/SagaUtils.py b/python/plugins/processing/algs/saga/SagaUtils.py index 76f684c0cd3..e2a7a08bde7 100644 --- a/python/plugins/processing/algs/saga/SagaUtils.py +++ b/python/plugins/processing/algs/saga/SagaUtils.py @@ -121,7 +121,10 @@ def getSagaInstalledVersion(runSaga=False): stderr=subprocess.STDOUT, universal_newlines=True, ).stdout - lines = proc.readlines() + try: + lines = proc.readlines() + except: + return None for line in lines: if line.startswith("SAGA Version:"): _installedVersion = line[len("SAGA Version:"):].strip().split(" ")[0] @@ -145,17 +148,20 @@ def executeSaga(progress): stderr=subprocess.STDOUT, universal_newlines=True, ).stdout - for line in iter(proc.readline, ''): - if '%' in line: - s = ''.join([x for x in line if x.isdigit()]) - try: - progress.setPercentage(int(s)) - except: - pass - else: - line = line.strip() - if line != '/' and line != '-' and line != '\\' and line != '|': - loglines.append(line) - progress.setConsoleInfo(line) + try: + for line in iter(proc.readline, ''): + if '%' in line: + s = ''.join([x for x in line if x.isdigit()]) + try: + progress.setPercentage(int(s)) + except: + pass + else: + line = line.strip() + if line != '/' and line != '-' and line != '\\' and line != '|': + loglines.append(line) + progress.setConsoleInfo(line) + except: + pass if ProcessingConfig.getSetting(SAGA_LOG_CONSOLE): ProcessingLog.addToLog(ProcessingLog.LOG_INFO, loglines)