From a30193a974fe9d621865b42c6bc5a87b8b3f4068 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 22 Jul 2020 11:58:19 -0400 Subject: [PATCH] Coerce to str if bytes in python 3 Nextscale code received bytes but needed str. Change-Id: Ie2951e9689fb7db1c9ff09d04a96acf0b779d638 --- pyghmi/ipmi/oem/lenovo/nextscale.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyghmi/ipmi/oem/lenovo/nextscale.py b/pyghmi/ipmi/oem/lenovo/nextscale.py index ed320ee8..b712947d 100644 --- a/pyghmi/ipmi/oem/lenovo/nextscale.py +++ b/pyghmi/ipmi/oem/lenovo/nextscale.py @@ -538,6 +538,8 @@ class SMMClient(object): if rsp.status != 200: raise Exception(rsp.read()) indexhtml = rsp.read() + if not isinstance(indexhtml, str): + indexhtml = indexhtml.decode('utf8') for line in indexhtml.split('\n'): if '"ST1"' in line: self.st1 = line.split()[-1].replace( @@ -551,6 +553,8 @@ class SMMClient(object): body = rsp.read() if rsp.status != 200: raise Exception(body) + if not isinstance(body, str): + body = body.decode('utf8') for line in body.split('\n'): if '"ST1"' in line: self.st1 = line.split()[-1].replace(