"jasonwiener" schrieb > > I am having a VERY odd problem with unpacking right now. > I'm reading data from a binary file and then using a very > simple struct.unpack to get a long. Works fine on my MacBook, > but when I push it to a Linux box,it acts differently and > ends up pewking. > [...] > > the data looks to be the same, but the unpacking seems to > treat it differently. > Probably little-endian vs. big-endian issue:
>>> s '\x1e\xc6\xf3\xb4' >>> struct.unpack('<I', s) (3035874846L,) >>> struct.unpack('>I', s) (516354996L,) See help(struct) for further information. This seems to imply that the Mac, although running now on Intel processors, is still big-endian. HTH Martin -- http://mail.python.org/mailman/listinfo/python-list