You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to filter nodes based on custom parameters that I uploaded in the data field. Namely I create a class and assign to dataa particular class.
However when I try to go through the nodes via filter, the node.data is not recognized and gives me a Nonetype. The following is my code and errors:
def tree():
tree = Tree()
tree.create_node("Harry", "harry") # root node
tree.create_node("Jane", "jane", parent="harry", data=Objects({"nae":1,"surname":2},5))
tree.create_node("Bill", "bill", parent="harry", data=Objects({"nae":1,"surname":2},88))
tree.create_node("Diane", "diane", parent="jane", data=Objects({"nae":1,"surname":2},2))
tree.create_node("Mary", "mary", parent="diane", data=Objects({"nae":1,"surname":2},1))
tree.create_node("Mark", "mark", parent="jane", data= Objects({"nae":1,"surname":2},20))
x = tree.filter_nodes(lambda y: y.data.b >7)
for i in x:
print(i)
AttributeError: 'NoneType' object has no attribute 'b'
Alternatively if I try to filter the tree based on the identifier or tag it all works out fine. Just data is not recognized at all and throws a Nonetype immediately as it is called.
Am I doing something wrong here or is filtering based on data not supported by the library?
Thanks in advance.
The text was updated successfully, but these errors were encountered:
I am trying to filter nodes based on custom parameters that I uploaded in the data field. Namely I create a class and assign to
data
a particular class.However when I try to go through the nodes via filter, the
node.data
is not recognized and gives me a Nonetype. The following is my code and errors:Alternatively if I try to filter the tree based on the identifier or tag it all works out fine. Just data is not recognized at all and throws a Nonetype immediately as it is called.
Am I doing something wrong here or is filtering based on data not supported by the library?
Thanks in advance.
The text was updated successfully, but these errors were encountered: