From 67fdd8c018fa31feeb13c03f3ce4d4f311020c2c Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Thu, 14 May 2020 13:22:55 -0600 Subject: [PATCH 1/2] scripts/common.py: fix decoding errors detected on Stampede --- scripts/common.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/common.py b/scripts/common.py index 801ecfcc..db6a63c6 100755 --- a/scripts/common.py +++ b/scripts/common.py @@ -59,18 +59,19 @@ def execute(cmd, abort = True): status = p.returncode if debug: message = 'Execution of "{0}" returned with exit code {1}\n'.format(cmd, status) - message += ' stdout: "{0}"\n'.format(stdout.decode('ascii').rstrip('\n')) - message += ' stderr: "{0}"'.format(stderr.decode('ascii').rstrip('\n')) + message += ' stdout: "{0}"\n'.format(stdout.decode('ascii', 'ignore').rstrip('\n')) + message += ' stderr: "{0}"'.format(stderr.decode('ascii', 'ignore').rstrip('\n')) logging.debug(message) if not status == 0: message = 'Execution of command {0} failed, exit code {1}\n'.format(cmd, status) - message += ' stdout: "{0}"\n'.format(stdout.decode('ascii').rstrip('\n')) - message += ' stderr: "{0}"'.format(stderr.decode('ascii').rstrip('\n')) + message += ' stdout: "{0}"\n'.format(stdout.decode('ascii', 'ignore').rstrip('\n')) + message += ' stderr: "{0}"'.format(stderr.decode('ascii', 'ignore').rstrip('\n')) if abort: raise Exception(message) else: logging.error(message) - return (status, stdout.decode('ascii').rstrip('\n'), stderr.decode('ascii').rstrip('\n')) + return (status, stdout.decode('ascii', 'ignore').rstrip('\n'), + stderr.decode('ascii', 'ignore').rstrip('\n')) def split_var_name_and_array_reference(var_name): """Split an expression like foo(:,a,1:ddt%ngas) From a477b63ee9bbbb84113239ee526f993da6f47132 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 1 Jun 2020 09:25:25 -0600 Subject: [PATCH 2/2] scripts/common.py: use argument names for optional arguments --- scripts/common.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/common.py b/scripts/common.py index db6a63c6..f638547a 100755 --- a/scripts/common.py +++ b/scripts/common.py @@ -59,19 +59,19 @@ def execute(cmd, abort = True): status = p.returncode if debug: message = 'Execution of "{0}" returned with exit code {1}\n'.format(cmd, status) - message += ' stdout: "{0}"\n'.format(stdout.decode('ascii', 'ignore').rstrip('\n')) - message += ' stderr: "{0}"'.format(stderr.decode('ascii', 'ignore').rstrip('\n')) + message += ' stdout: "{0}"\n'.format(stdout.decode(encoding='ascii', errors='ignore').rstrip('\n')) + message += ' stderr: "{0}"'.format(stderr.decode(encoding='ascii', errors='ignore').rstrip('\n')) logging.debug(message) if not status == 0: message = 'Execution of command {0} failed, exit code {1}\n'.format(cmd, status) - message += ' stdout: "{0}"\n'.format(stdout.decode('ascii', 'ignore').rstrip('\n')) - message += ' stderr: "{0}"'.format(stderr.decode('ascii', 'ignore').rstrip('\n')) + message += ' stdout: "{0}"\n'.format(stdout.decode(encoding='ascii', errors='ignore').rstrip('\n')) + message += ' stderr: "{0}"'.format(stderr.decode(encoding='ascii', errors='ignore').rstrip('\n')) if abort: raise Exception(message) else: logging.error(message) - return (status, stdout.decode('ascii', 'ignore').rstrip('\n'), - stderr.decode('ascii', 'ignore').rstrip('\n')) + return (status, stdout.decode(encoding='ascii', errors='ignore').rstrip('\n'), + stderr.decode(encoding='ascii', errors='ignore').rstrip('\n')) def split_var_name_and_array_reference(var_name): """Split an expression like foo(:,a,1:ddt%ngas)