Odoo Help

0

What means "Too many values to unpack" message?

By
Mohammed Osman Gomda
on 4/16/13, 10:23 AM 25,162 views

Can any one give me the cause of the above error message

Some context may help. Anyway, in python normally means you are trying to unpack a tuple with more values repect to target variables. Example: a,b = returnATupleOfMoreThan2Values()

Jethroso
on 4/16/13, 10:39 AM
1

Nicolas Bessi

--Nicolas Bessi--
1598
| 5 7 8
Lausanne, Switzerland
--Nicolas Bessi--
Nicolas Bessi
On 4/16/13, 10:41 AM

It is a Python exception that is the most ofen risen during assignation error: You try to do multiple assignment :

a, b = (1, 2, 3)  #  There is too many value to unpack ;)
a, b = (1, 2)  # That will work
a, b = 'base.main_company'.split('.')  # OK
a, b = 'base.main.company'.split('.')  # KO

In OpenERP it generaly comes when there is a dot in an XML ID. <record id='my.car' ... You should not use the dot when creating an XML ID. It can also be risen when you try to acces 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...

Regards

Nicolas

0

Priyesh Solanki (pso)

--Priyesh Solanki (pso)--
Tiny ERP Pvt Ltd
http://www.odoo.com
1120
| 2 2 4
--Priyesh Solanki (pso)--
Priyesh Solanki (pso)
On 4/16/13, 10:48 AM

Another case may be regarding looping over dictionary. If one is looping on any dictionary with key and val both without using iteritems(), one will face this error:

a = {'test': 1, 'test 1': 2} 
for k, v in a:
    print k

It will give you that error but instead of one should use it like this:

a = {'test': 1, 'test 1': 2}
for k, v in a.iteritems():
    print k

Still more information can be useful!

Thanks, Priyesh Solanki

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 4/16/13, 10:23 AM
Seen: 25162 times
Last updated: 3/16/15, 8:10 AM