pack and unpack problems

Mike Rovner mike at bindkey.com
Tue Jun 17 22:11:39 EDT 2003


"Justin Johnson" <justinjohnson at fastmail.fm> wrote in message
> exceptions.ValueError: unpack tuple of wrong size
>
> struct.calcsize('xxLxx8c') returns 18, which is the amount of bytes in
> "data", at least I think so.

Hm, make yourself sure:

assert len(data)==struct.calcsize('xxLxx8c')

Mike

PS. Better use '!xxLxx8c' cause N is network order 4-byte long

PPS. xxNxxH8 = 1+1+4+1+1+8 = 16, so check alignment!








More information about the Python-list mailing list