Wednesday, April 25, 2012

Struct.Error, Must Be a Bytes Object?

I am attempting to execute the code:

    values = (1, 'ab', 2.7)    
s.struct.Struct('I 2s f')
packed = s.pack(*values)

But I keep getting the error:

    Traceback (most recent call last):
File "<stdin>", line 1, in <module>
struct.error: argument for 's' must be a bytes object

Why?How do I fix this?

No comments:

Post a Comment