Re: Unpacking problem

2007-03-01 Thread timm . gloger
Ok, that solves my confusion. Thanks, Marc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Unpacking problem

2007-03-01 Thread timm . gloger
The problem is, that len('\x90\x06\x00') is not equivalent to calcsize('Bh'): >>> calcsize('Bh') 4 >>> len('\x90\x06\x00') 3 Actually calculating the size for 'hB' results in: >>> calcsize('hB') 3 So far I have not figured out, why there is an additional byte, but it does not effect the result in

Re: Unpacking problem

2007-03-01 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Chris Garland wrote: > But an unsigned char & a short give me this unpack('Bh','\x90\x06\x00') > Traceback (most recent call last): > File "", line 1, in ? > struct.error: unpack str size does not match format Let's pack this: In [90]: pack('Bh', 0x90, 0x6) Out[90]