Nested Dicts

Victor Subervi victorsubervi at gmail.com
Sat Dec 5 10:52:10 EST 2009


Hi;
I have the following error:

 /var/www/html/angrynates.com/cart/catTree.py in
getChildren(levelDict={'cat3': {}}, level=0)
   23   if level > MAXLEVEL:
   24     return  #possibly the data has a cycle/loop
   25   for (nm, dt) in levelDict: ### ERROR HERE
   26     cursor.execute('''select c.name from categories as c
   27       inner join relationship as r
nm undefined, dt undefined, levelDict = {'cat3': {}}

ValueError: too many values to unpack
      args = ('too many values to unpack',)

However...

>>> d = {'cat': {'one':'two'}}
>>> for a, b in d:
...
  File "<stdin>", line 2

    ^
IndentationError: expected an indented block
>>> d = {'cat': {}}
>>> for a, b in d:
...
  File "<stdin>", line 2

    ^
IndentationError: expected an indented block
>>>

So apparently, if either the nested dict is populated or not doesn't seem to
throw any errors in the interpreter. What, then, is the nature of this
error?
TIA,
Victor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091205/4949c6d7/attachment-0001.html>


More information about the Python-list mailing list