unsupported operand type(s) for %: 'NoneType' and 'tuple'

Victor Subervi victorsubervi at gmail.com
Mon Dec 7 05:25:07 EST 2009


Hi;
I get the following error:

/var/www/html/angrynates.com/cart/createCats2.py
  111 </form>
  112 </body></html>
  113 '''
  114
  115 createCats2()
createCats2 = <function createCats2>
 /var/www/html/angrynates.com/cart/createCats2.py in createCats2()
   85   for standAloneStore in storePrimaryStandAlone:
   86     allStores.append(standAloneStore)
   87   tree = catTree(allStores)
   88   for store in allStores:
   89     i = 0
tree undefined, global catTree = <function catTree>, allStores =
['products', 'prescriptions']
 /var/www/html/angrynates.com/cart/catTree.py in
catTree(allStores=['products', 'prescriptions'])
   76       returnFlag = 'gotNoStuff'
   77   if returnFlag == 'gotStuff':
   78     return printTree(allTrees)
   79   else:
   80     return ''
global printTree = <function printTree>, allTrees = [{'prodCat1': {},
'prodCat2': {}}, {'presCat1': {}, 'presCat2': {}}]
 /var/www/html/angrynates.com/cart/catTree.py in
printTree(allTrees=[{'prodCat1': {}, 'prodCat2': {}}, {'presCat1': {},
'presCat2': {}}], level=0)
   12     for name in sorted(aTree.keys()):
   13       print '\t' * level, name
   14       tree.append("%s%s") % ("\t" * level, name)
   15       printTree(aTree[name], level + 1)
   16
tree = ['%s%s'], tree.append = <built-in method append of list object>,
level = 0, name = 'prodCat1'

TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'
      args = ("unsupported operand type(s) for %: 'NoneType' and 'tuple'",)

But according to the same error, level = 0 [the NoneType, I presume] and
name = 'prodCat1', which is most certainly not a tuple! Why the error?
TIA,
Victor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091207/b786adce/attachment-0001.html>


More information about the Python-list mailing list