treelib.tree.NodeIDAbsentError: Parent node '...' is not in the tree
Running this code:
from treelib import Node, Tree
class Apple():
def __init__(self, name):
self.name = name
def __str__(self):
return self.name
harryApple = Apple("Harry")
addonApple = Apple("Addons")
tree = Tree()
harryNode = Node( harryApple ) # root node
addonNode = Node( addonApple )
tree.add_node( harryNode )
tree.add_node( addonNode, parent=harryNode )
tree.show()
Results in:
Traceback (most recent call last):
File "D:\User\Dropbox\Applications\SoftwareVersioning\ComputerScienceGraduation\Semester20171\treelib\test.py", line 19, in <module>
tree.add_node( addonNode, parent=harryNode )
File "D:\User\Dropbox\Applications\SoftwareVersioning\ComputerScienceGraduation\Semester20171\treelib\treelib\tree.py", line 279, in add_node
"is not in the tree" % parent)
treelib.tree.NodeIDAbsentError: Parent node 'Node(tag=<__main__.Apple instance at 0x0250DF58>, identifier='7b806e1e-17c5-11e7-95e9-6c626d784ee9', data=None)' is not in the tree
I added the node harry, but why it is not in the tree?
treelib.tree.NodeIDAbsentError: Parent node '...' is not in the tree
Running this code:
Results in:
I added the node harry, but why it is not in the tree?