Conversion of perl unpack code to python - something odd
Fredrik Lundh
fredrik at pythonware.com
Thu May 18 09:50:53 EDT 2006
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 are too many values to unpack.
>
> Traceback ( most recent call last)
> File "m:\mq\mq\scripts\format.py", line 32, in ?
> d1, d2 = struct.unpack(format,data)
> ValueError: too many values to unpack
> Error starting triggered application
>
> I checked the manual on the structure used to pack the code and it
> appears correct.
try printing the return value from struct.unpack, and see if you can
figure out what's wrong with your code:
print struct.unpack(format,data)
</F>
More information about the Python-list
mailing list