There seems to be some ordering issues when using format strings in Python.
For example, I am trying to unpack, in order: 3 doubles, 1 float, 2 doubles.
This should be 5*8+4 == 44 bytes in size.
Consider the following code:
import struct
A = struct.calcsize("dddfdd")
B = struct.calcsize("dddf")+struct.calcsize("dd")
C = struct.calcsize("dddddf")
For me, in Python 3.6.9 on Linux, I get that A == 48, meanwhile B == C == 44 (as I would expect).
This means that something like the following would fail, when packed_data is 44 bytes.
unpacked_data = struct.unpack('dddfdd',packed_data)
I can, instead, resort to:
unpacked_data1 = struct.unpack('dddf',packed_data1)
unpacked_data2 = struct.unpack('dd',packed_data2)
What gives? Is there a better way to do the unpacking?
=prefix for the format string. See docs.python.org/3/library/…