Python 2.7x and 3.xx compatibility fixes
Change-Id: I84eb3bf7691fa867acadf9dae8c4f56a9781bf73
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/gen_cmd.py b/lib/gen_cmd.py
index 5e004c1..6f88be1 100644
--- a/lib/gen_cmd.py
+++ b/lib/gen_cmd.py
@@ -96,7 +96,11 @@
out_buf = ""
if return_stderr:
for line in sub_proc.stderr:
- err_buf += line
+ try:
+ err_buf += line
+ except TypeError:
+ line = line.decode("utf-8")
+ err_buf += line
if not print_output:
continue
if robot_env:
@@ -104,7 +108,11 @@
else:
sys.stdout.write(line)
for line in sub_proc.stdout:
- out_buf += line
+ try:
+ out_buf += line
+ except TypeError:
+ line = line.decode("utf-8")
+ out_buf += line
if not print_output:
continue
if robot_env:
@@ -417,12 +425,20 @@
try:
if return_stderr:
for line in sub_proc.stderr:
- err_buf += line
+ try:
+ err_buf += line
+ except TypeError:
+ line = line.decode("utf-8")
+ err_buf += line
if not print_output:
continue
func_stdout += line
for line in sub_proc.stdout:
- out_buf += line
+ try:
+ out_buf += line
+ except TypeError:
+ line = line.decode("utf-8")
+ out_buf += line
if not print_output:
continue
func_stdout += line