try twiddling the unpack prefix, they're probably stored in different binary formats on the disk...
on the struct helppage, is a list of prefixes, can be like unpack('=HI',data) unpack('@HI',data) etc... find out which one works on each machine 2008/3/16, jasonwiener <[EMAIL PROTECTED]>: > > Hi- > > 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. > > here's the code snippet: > fread.seek(0,0) > tmp_rebuild = fread.read() > fread.close() > tmp_long = tmp_rebuild[0:4] > print tmp_long.encode('hex') > print repr(tmp_long) > > unpacked_long = struct.unpack('I', > tmp_rebuild[0:4])[0] > print 'unpacked_long: %s' % unpacked_long > > my MacBook produces: > 1ec6f3b4 > '\x1e\xc6\xf3\xb4' > unpacked_long: 516354996 > > but on the linux box the same code produces: > 1ec6f3b4 > '\x1e\xc6\xf3\xb4' > unpacked_long: 3035874846 > > the data looks to be the same, but the unpacking seems to treat it > differently. > > Has anyone an idea of why this happens??? > > Thanks- > J. > > > > -- > http://mail.python.org/mailman/listinfo/python-list >
-- http://mail.python.org/mailman/listinfo/python-list