Length of Byte Array?


#1

How can I find the length [in bytes] of a bytearray ?
Specifically, I need to find the size of an object created by msgPack before I can send it via a UART.
( I am using a simple protocol for the Uart comms similar to HDLC but I need to know the length of the data packet ).


#2

Hi @w1bworx,

have you tried with len(yourbytearray)?


#3

Hmmm
That was my first thought but when I tried it caused the program to crash.
I tried adding and removing the offending line and it was pretty clear.
But something else was going on as well as after a few more attempts uploads started to fail.

Long story but I eventually reloaded the VM and now everything is running as expected.
Hopefully was just down to gremlins or perhaps there is something flakey on this board admittedly it has been reprogrammed many times a day for probably too long
… I will maybe try another and let you know if this happens again.

So sorry to bother you with this but for the moment all is well,.