From 6bbf650031aee69c2d44e2066532cca30490fb17 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 12 Aug 2016 14:27:12 -0400 Subject: [PATCH] Declare strings explicitly as binary Python 3 requires that strings be explicitly declared as binary if they need to be treated as such (implicit strings are unicode rather than ascii) Change-Id: I17e5d2ef44ffc106c94b95247585130b07d44417 --- pyghmi/ipmi/command.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pyghmi/ipmi/command.py b/pyghmi/ipmi/command.py index 34fb358f..efc26cc2 100644 --- a/pyghmi/ipmi/command.py +++ b/pyghmi/ipmi/command.py @@ -178,7 +178,7 @@ class Command(object): 'device_id': response['data'][0], 'device_revision': response['data'][1] & 0b1111, 'manufacturer_id': struct.unpack( - ' len(password) > 16: - password = password.ljust(20, '\x00') + password = password.ljust(20, b'\x00') data[0] |= 0b10000000 elif len(password) > 20: raise Exception('password has limit of 20 chars') @@ -1674,7 +1674,7 @@ class Command(object): # however another convention that exists is all '\xff' # if this fails, pass up the error so that calling code knows # that the deletion did not go as planned for now - self.set_user_name(uid, '\xff' * 16) + self.set_user_name(uid, b'\xff' * 16) return True def disable_user(self, uid, mode):