Unpack Error.

This is the place for queries that don't fit in any of the other categories.

Unpack Error.

Postby Harever » Wed Dec 25, 2013 5:45 pm

Hello,

I'm having trouble in the unpack of my code shows the following error:


utfLength=struct.unpack('!h', data[:2])[0]
error: unpack requires a string argument of length 2


Code:

Code: Select all
utfLength=struct.unpack('!h', data[:2])[0]
                                PassHash=data[2:utfLength+2]
                                data=data[utfLength+2:]
                                utfLength=struct.unpack('!h', data[:2])[0]
                                ForumPassHash=data[2:utfLength+2]
                                data=data[utfLength+2:]
                                utfLength=struct.unpack('!h', data[:2])[0]
                                ForumSalt=data[2:utfLength+2]


Can anyone help me solve this problem? :cry:
Last edited by micseydel on Wed Dec 25, 2013 6:34 pm, edited 1 time in total.
Reason: First post lock.
Harever
 
Posts: 1
Joined: Wed Dec 25, 2013 5:40 pm

Re: Unpack Error.

Postby rrashkin » Thu Dec 26, 2013 3:15 pm

What is "data" when you start?
___________________
Bob Rashkin
User avatar
rrashkin
 
Posts: 35
Joined: Tue Feb 12, 2013 4:47 pm


Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 2 guests