Online Tutorials & Training Materials |
Register Login

ValueError: Too many values to unpack in Python

|| 0

ValueError: Too many values to unpack in Python

User Getting an Exception

Too many values to unpack exception in Python

There could be possible reasons are.

Cause 1

Too many values to unpack exception this exception means that a program trying to unpack a tuple (or you can say that assigning and accessing multiple values to a variable), which has multiple values with respect to the target variable.

It is an exception that is the most often risen during assignation error in Python: You try to do multiple assignments

  • c, d = (5, 6, 7)  #  There is too many value to unpack ;)
  • c, d = (5, 6)  # That will work
  • c, d = 'base.main_company'.split('.')  # OK
  • c, d = ''.split('.')  # KO

In Open ERP it generally comes when there is a dot in an XML ID. <record id='' ... You should not use the dot when creating an XML ID. It can also rise when you try to access an item by his XML id and pass wrong parameters.

That the most common cases but it may also come from any other piece of code...

def printing three values()	
return (9,10,11)
a,b,c = printing three values()
print a
print b
print c

But this raises your error

def returnATupleWithThreeValues():
return (1,2,3)
a,b = returnATupleWithThreeValues()
print a
print b


Traceback (most recent call last):
File "", line 3, in ?
a,b = returnATupleWithThreeValues()
ValueError: too many values to unpack

Now, the reason why this happens in your case, I don't know, but maybe this answer will point you in the right direction.

Cause 2

  • Incorrect configuration in the network settings. 
  • User activation URL is set as - <Name/IP of the server>:<port>
  • To verify this issue, open the .idk file and check if the values are as follows:

                 servers = ['Test.druvaLabs.local:443:443']


  1. Login to the inSync Admin console>Manage > Settings > Network sub-tab.
  2. Set the User Activation URL as the name or the FQDN only and remove the port number.
  3. The .idk file should now have servers flag value as follows 

Related Articles