diff options
author | Panagiotis Karalis <panos.pkaralis@gmail.com> | 2019-09-17 11:55:58 +0300 |
---|---|---|
committer | Panagiotis Karalis <panos.pkaralis@gmail.com> | 2019-09-18 12:22:21 +0300 |
commit | 9b8d8fcc9f4f191374f730b13fcb0ce18905864c (patch) | |
tree | 9b6e11497df6ef9028577881afc8bfe175342ee2 /dovetail/utils/dovetail_utils.py | |
parent | 005d868d68dbb0e70b3f92a685ea269c4f646fd7 (diff) |
Fault fixing for cmd_exec util method
When the 'dovetail run' command is assigned, the error
"TypeError: must be str, not bytes" is appeared.
Due to a different handling of strings in the Python3, this error
is appeared during of command execution (i.e. exec_cmd method).
Each piece of the string should be decoded, before it will be
appended to the rest one.
Signed-off-by: Panagiotis Karalis <panos.pkaralis@gmail.com>
Change-Id: I65629f3f76cc3e44f3926a744d00791ef588d2aa
Diffstat (limited to 'dovetail/utils/dovetail_utils.py')
-rw-r--r-- | dovetail/utils/dovetail_utils.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/dovetail/utils/dovetail_utils.py b/dovetail/utils/dovetail_utils.py index 9259b03f..306dacd1 100644 --- a/dovetail/utils/dovetail_utils.py +++ b/dovetail/utils/dovetail_utils.py @@ -60,8 +60,9 @@ def exec_cmd(cmd, logger=None, exit_on_error=False, info=False, count = 1 DEBUG = os.getenv('DEBUG') for line in iter(p.stdout.readline, b''): - exec_log(verbose, logger, line.strip(), level, True) - stdout += line + exec_log(verbose, logger, line.strip().decode('unicode-escape'), + level, True) + stdout += str(line) if progress_bar and (DEBUG is None or DEBUG.lower() != 'true'): show_progress_bar(count) count += 1 |