diff --git a/src/spi/binary/__init__.py b/src/spi/binary/__init__.py index bf82691..62ba939 100644 --- a/src/spi/binary/__init__.py +++ b/src/spi/binary/__init__.py @@ -672,13 +672,13 @@ def tobytes(self): bits += tmp elif datalength >= 254 and datalength <= 1<<16: tmp = bitarray() - tmp.fromstring('\xfe') + tmp.frombytes'\xfe') bits += tmp tmp = encode_number(datalength, 16) bits += tmp elif datalength > 1<<16 and datalength <= 1<<24: tmp = bitarray() - tmp.fromstring('\xff') + tmp.frombytes('\xff') bits += tmp tmp = encode_number(datalength, 24) bits += tmp