Re: Conversion of perl unpack code to python - something odd

2006-05-18 Thread Andrew Robert
Peter Otten wrote: > Andrew Robert wrote: > >> format='4s 4s 48s 48s 64s 4s 256s 128s 128s 48s' > > You are trying to squeeze 10 items into just > >> d1,d2=struct.unpack(format,data) > > two variables (d1 and d2) > >> ValueError: too many values to unpack > > and Python is quite explicit that

Re: Conversion of perl unpack code to python - something odd

2006-05-18 Thread Peter Otten
Andrew Robert wrote: > format='4s 4s 48s 48s 64s 4s 256s 128s 128s 48s' You are trying to squeeze 10 items into just > d1,d2=struct.unpack(format,data) two variables (d1 and d2) > ValueError: too many values to unpack and Python is quite explicit that it doesn't like that once you realize tha

Re: Conversion of perl unpack code to python - something odd

2006-05-18 Thread Fredrik Lundh
Andrew Robert wrote: > # From the language declarations in manual, the following format was derived > > format='4s 4s 48s 48s 64s 4s 256s 128s 128s 48s' that's 10 specifiers. > d1,d2=struct.unpack(format,data) that's two variables. > print d1 > sys.exit(0) > > When I run it, it says there ar