TypeError: string argument without an encoding

Bug #1868942 reported by Vlad
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pyghmi
New
Undecided
Unassigned

Bug Description

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/pyghmi/ipmi/oem/lenovo/energy.py", line 30, in __init__
    data=self.iana + b'\x00\x00\x01')
  File "/usr/local/lib/python3.6/site-packages/pyghmi/ipmi/command.py", line 459, in xraw_command
    raise exc.IpmiException(rsp['error'], rsp['code'])
pyghmi.exceptions.IpmiException: Invalid command

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./ipmi_sensors_discovery.py", line 54, in <module>
    print(*sensors_descriptions, sep='\n')
  File "/usr/local/lib/python3.6/site-packages/pyghmi/ipmi/command.py", line 990, in get_sensor_descriptions
    for sensor in self._oem.get_sensor_descriptions():
  File "/usr/local/lib/python3.6/site-packages/pyghmi/ipmi/oem/lenovo/handler.py", line 421, in get_sensor_descriptions
    return self.immhandler.get_oem_sensor_descriptions(self.ipmicmd)
  File "/usr/local/lib/python3.6/site-packages/pyghmi/ipmi/oem/lenovo/imm.py", line 628, in get_oem_sensor_descriptions
    } for x in self.get_oem_sensor_names(ipmicmd)]
  File "/usr/local/lib/python3.6/site-packages/pyghmi/ipmi/oem/lenovo/imm.py", line 621, in get_oem_sensor_names
    self._energymanager = energy.EnergyManager(ipmicmd)
  File "/usr/local/lib/python3.6/site-packages/pyghmi/ipmi/oem/lenovo/energy.py", line 33, in __init__
    self.iana = bytearray('\x4d\x4f\x00')
TypeError: string argument without an encoding

--- energy.py 2020-03-25 12:28:56.840767989 +0300
+++ energy-fix.py 2020-03-25 12:29:39.569242159 +0300
@@ -30,9 +30,9 @@
                                        data=self.iana + b'\x00\x00\x01')
         except pygexc.IpmiException as ie:
             if ie.ipmicode == 193: # try again with IBM IANA
- self.iana = bytearray('\x4d\x4f\x00')
+ self.iana = bytearray(b'\x4d\x4f\x00')
                 rsp = ipmicmd.xraw_command(netfn=0x2e, command=0x82,
- data=self.iana + '\x00\x00\x01')
+ data=self.iana + b'\x00\x00\x01')
             else:
                 raise
         if rsp['data'][4:6] not in (b'\x02\x01', b'\x02\x06', b'\x02\x09'):

Revision history for this message
Vlad (badfiles) wrote :

--- pyghmi/pyghmi/ipmi/oem/lenovo/energy.py 2020-03-25 12:28:56.840767989 +0300
+++ pyghmi/pyghmi/ipmi/oem/lenovo/energy.py 2020-03-25 12:29:39.569242159 +0300
@@ -30,9 +30,9 @@
                                        data=self.iana + b'\x00\x00\x01')
         except pygexc.IpmiException as ie:
             if ie.ipmicode == 193: # try again with IBM IANA
- self.iana = bytearray('\x4d\x4f\x00')
+ self.iana = bytearray(b'\x4d\x4f\x00')
                 rsp = ipmicmd.xraw_command(netfn=0x2e, command=0x82,
- data=self.iana + '\x00\x00\x01')
+ data=self.iana + b'\x00\x00\x01')
             else:
                 raise
         if rsp['data'][4:6] not in (b'\x02\x01', b'\x02\x06', b'\x02\x09'):

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.