The read method in the Param class contains the following:
class Param(object):
...
def read(self, handle):
...
self.bytes = ''
if self.total_bytes:
self.bytes = handle.read(self.total_bytes)
...
If self.total_bytes is 0, then self.bytes is of type str not bytes.
A subsequent call to Param.string_value will raise an AttributeError:
File "lib/python3.6/site-packages/c3d.py", line 500, in get_string return self.params[key.upper()].string_value
File "lib/python3.6/site-packages/c3d.py", line 323, in string_value return self.bytes.decode('utf-8')
AttributeError: 'str' object has no attribute 'decode'
The read method in the Param class contains the following:
If
self.total_bytes
is 0, thenself.bytes
is of typestr
notbytes
.A subsequent call to Param.string_value will raise an AttributeError: