taskMgr.add Problem

Hi all

For my game I need a function to get all children of a node.

def childs(node):
	if node.getNumChildren() == 0:
		print "NODE: ", node, "\n\tHPR: ", node.getHpr(), "\n\tPos: ", node.getPos()
		return Task.cont
	else:
		for i in range(0, node.getNumChildren() ):
			childs(node.getChild(i))
		return Task.cont

taskMgr.add(childs, "viewtask", extraArgs= mynode)

when I try to run it i get

  File "test.py", line 35, in ?
    run()
  File "D:\Panda3D-1.1.0\direct\src\showbase\ShowBase.py", line 1798, in run
    self.taskMgr.run()
  File "D:\Panda3D-1.1.0\direct\src\task\Task.py", line 782, in run
    self.step()
  File "D:\Panda3D-1.1.0\direct\src\task\Task.py", line 730, in step
    self.__stepThroughList(taskPriList)
  File "D:\Panda3D-1.1.0\direct\src\task\Task.py", line 673, in __stepThroughList
    ret = self.__executeTask(task)
  File "D:\Panda3D-1.1.0\direct\src\task\Task.py", line 602, in __executeTask
    ret = task(*task.extraArgs)
TypeError: Task instance argument after * must be a sequence

Whats the matter

Ok sorry. I’ve got it

The right call is

taskMgr.add(childs, "viewtask", extraArgs= [mynode])