I have a 300x57 bytes array taken from serial port and shared then I intend to unpickle it directly into numpy array
so I make a dtype with 57 byte size
onebuffdtype = np.dtype(
"b1, b1, f4, u4, u2, u1, f4, u4, u2, u1, f4, i4, i2, i1, f4, u4, u2, u1, f4, u4, u2, u1")
then if
shared_buff1.buf
is place where buffer is located
buff1_np = np.ndarray((300, 57,), dtype=onebuffdtype,
buffer=shared_buff1.buf)
but it says
TypeError: buffer is too small for requested array
The shape of an array is the number of elements, not bytes it contains. If your elements are all 57 bytes in size, then a 300x57 byte buffer is just the right size to initialize an array of size 300: