On Sep 10, 1:12 pm, Aaron Scott <[EMAIL PROTECTED]> wrote: > Sorry, I had posted the wrong error. The error I am getting is: > > struct.error: unpack requires a string argument of length 12 > > which doesn't make sense to me, since I'm specifically asking for 11. > Just for kicks, if I change the line to > > print struct.unpack('3sII', file.read(12)) > > I get the result > > ('GDE', 33554432, 16777216) > > ... which isn't even close, past the first three characters.
Sometimes 'endian' order can cause this. Try '<3sII' and '>3sII' for your formats to differentiate. Also, if your file is not packed the way that 'struct' expects, you might need to read the string and integers separately. /Example: >>> struct.Struct( '3s' ).size + struct.Struct( 'II' ).size 11 >>> struct.Struct( '3sII' ).size 12 -- http://mail.python.org/mailman/listinfo/python-list