Re: Strange problem with structs Linux vs. Mac

2008-03-18 Thread Martin Blume
"Marc 'BlackJack' Rintsch" schrieb > > > I don't think this qualifies as a bug, but I am astonished > > that the struct module does not tell you whether you are > > big endian, you have to find out yourself with > >struct.unpack('@I', s)[0]==struct.unpack(">I", s)[0] > > Maybe a little more

Re: Strange problem with structs Linux vs. Mac

2008-03-17 Thread Marc 'BlackJack' Rintsch
On Sun, 16 Mar 2008 18:45:19 +0100, Martin Blume wrote: > I don't think this qualifies as a bug, but I am astonished > that the struct module does not tell you whether you are > big endian, you have to find out yourself with >struct.unpack('@I', s)[0]==struct.unpack(">I", s)[0] Maybe a little

Re: Strange problem with structs Linux vs. Mac

2008-03-16 Thread jasonwiener
Completely helped! Working as expected now. Thanks. You really got me out of a bind! J. On Mar 16, 10:23 am, "Martin Blume" <[EMAIL PROTECTED]> wrote: > "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

Re: Strange problem with structs Linux vs. Mac

2008-03-16 Thread Martin Blume
"sturlamolden" schrieb > > > This seems to imply that the Mac, although running now > > on Intel processors, is still big-endian. > > Or maybe the struct module thinks big-endian is native > to all Macs? It could be a bug. > Dunno, I'm on thin ice here. Never used a Mac. Maybe the underlying

Re: Strange problem with structs Linux vs. Mac

2008-03-16 Thread Michael Wieher
you can specifify which encoding when you unpack the struct, so just try them till it works, or read the specs on the mac.. i find it quicker to try, there's only 4-5 2008/3/16, sturlamolden <[EMAIL PROTECTED]>: > > On 16 Mar, 18:23, "Martin Blume" <[EMAIL PROTECTED]> wrote: > > > This seems to im

Re: Strange problem with structs Linux vs. Mac

2008-03-16 Thread sturlamolden
On 16 Mar, 18:23, "Martin Blume" <[EMAIL PROTECTED]> wrote: > This seems to imply that the Mac, although running now on Intel > processors, is still big-endian. Or maybe the struct module thinks big-endian is native to all Macs? It could be a bug. -- http://mail.python.org/mailman/listinfo/p

Re: Strange problem with structs Linux vs. Mac

2008-03-16 Thread Martin Blume
"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. > [...]

Re: Strange problem with structs Linux vs. Mac

2008-03-16 Thread Michael Wieher
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]>: > > H

Strange problem with structs Linux vs. Mac

2008-03-16 Thread jasonwiener
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: