[Solved] ValueError: too many values to unpack (Python 2.7)


Check the output of

print len(values)

It has more than 5 values (which is the number of variables you are trying to “unpack” it to) which is causing your “too many values to unpack” error:

username, passwordHash, startRoom, originUrl, bs64encode = values

If you want to ignore the tail end elements of your list, you can do the following:

#assuming values has a length of 6
username, passwordHash, startRoom, originUrl, bs64encode, _ = values

or unpack only the first 5 elements (thanks to @JoelCornett)

#get the first 5 elements from the list
username, passwordHash, startRoom, originUrl, bs64encode = values[:5]

2

solved ValueError: too many values to unpack (Python 2.7)