You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for your DLMS package, it has been proved very useful.
Issue
I found a bug in dlms_cosem/dlms_data.py when converting the COSEM DataArray object to bytes. Atm, it appends to its bytearray from encode_variable_integer which returns bytes, this raises:
TypeError: 'bytes' object cannot be interpreted as an integer
I guess the intention is to extend as done in DataStructure.
Proposal
Change:
class DataArray(BaseDlmsData):
"""Sequence of Data"""
TAG = 1
LENGTH = VARIABLE_LENGTH
def to_bytes(self) -> bytes:
out = bytearray()
out.append(self.TAG)
out.append(encode_variable_integer(len(self.value)))
to:
class DataArray(BaseDlmsData):
"""Sequence of Data"""
TAG = 1
LENGTH = VARIABLE_LENGTH
def to_bytes(self) -> bytes:
out = bytearray()
out.append(self.TAG)
out.extend(encode_variable_integer(len(self.value)))
The text was updated successfully, but these errors were encountered:
Error when creating data from DlmsData. Function returns bytes and not an int so should have been extend instead of append.
Fixes#73
(fix) Append on bytes in DataArray.to_bytes
Error when creating data from DlmsData. Function returns bytes and not an int so should have been extend instead of append.
Fixes#73
(fix) Append on bytes in DataArray.to_bytes
Error when creating data from DlmsData. Function returns bytes and not an int so should have been extend instead of append.
Fixes#73
(fix) Append on bytes in DataArray.to_bytes
Error when creating data from DlmsData. Function returns bytes and not an int so should have been extend instead of append.
Fixes#73
(fix) Append on bytes in DataArray.to_bytes
Error when creating data from DlmsData. Function returns bytes and not an int so should have been extend instead of append.
Fixes#73
(fix) Append on bytes in DataArray.to_bytes
Error when creating data from DlmsData. Function returns bytes and not an int so should have been extend instead of append.
Fixes#73
(fix) Append on bytes in DataArray.to_bytes
Error when creating data from DlmsData. Function returns bytes and not an int so should have been extend instead of append.
Fixes#73
(fix) Append on bytes in DataArray.to_bytes
Error when creating data from DlmsData. Function returns bytes and not an int so should have been extend instead of append.
Fixes#73
Hi Henrik,
Thanks for your DLMS package, it has been proved very useful.
Issue
I found a bug in dlms_cosem/dlms_data.py when converting the COSEM DataArray object to bytes. Atm, it appends to its
bytearray
fromencode_variable_integer
which returns bytes, this raises:TypeError: 'bytes' object cannot be interpreted as an integer
I guess the intention is to extend as done in
DataStructure
.Proposal
Change:
to:
The text was updated successfully, but these errors were encountered: