XBee3 Micropython: when using transmit, what is buffer protocol error when payload is dictionary type

Hello,

using my xbee3 micropython script I have successfully sent data to my coordinator from my router module using:

xbee.transmit(addr64, data)

now that works when the data is a bytearray type

when I attempt to send dictionary type via the same built-in:


xbee.transmit(addr64, data_dict)

I get this error:


Transmit failure: object with buffer protocol required

My question is what is the cause of this error (type of payload im assuming)

secondly, what does “object with buffer protocol required” mean really?

thank you,

:slight_smile:

Yes, a dictionary cannot be translated to bytes implicitly. An object with buffer protocol just means it can be implicitly translated to a payload of contiguous binary data.
Certain objects available in MicroPython and Python wrap access to an underlying memory array or buffer. Such objects include the built-in bytes and bytearray.

2 Likes