Re: Unpack Expects the Wrong Number of Bytes

2009-07-18 Thread Ross Ridge
Timothy Crone wrote: >header = "s" >data = list(unpack(header,f.read(1))) > >however this: > >header = "si" >data = list(unpack(header,f.read(5))) > >throws > >struct.error: unpack requires a string argument of length 8 > >So unpack expects 7 additional bytes when an integer is added to the >form

Re: Unpack Expects the Wrong Number of Bytes

2009-07-18 Thread John Machin
On Jul 19, 12:34 am, Timothy Crone wrote: > Hello, > > I have noticed that for certain format strings, struct.unpack expects > the wrong number of bytes. [snip] > header = "si" > data = list(unpack(header,f.read(5))) > > throws > > struct.error: unpack requires a string argument of length 8 > > So