Daphna
Daphna
I have tried doing something like this but it didn't change the order of the nodes in the tree: ``` def sort_tree(tree,node): if len(tree.children(node.identifier)) == 0: return None else: children...
yes i see what you mean but doing this doesn't sort either ``` def sort_tree(tree,node): if len(tree.children(node.identifier)) == 0: return None else: children = tree.children(node.identifier) for child in children: tree.children(node.identifier).sort(key=lambda...
I need to pass a sorted json representation of the tree
Thanks! is filter_nodes on the latest version? or its not released yet?
Running your example I get the following error: ``` return key_value_function(next(tree.filter_nodes(lambda node: node.tag == child_tag))) TypeError: list object is not an iterator ```
yes i am on python 2, it resolved that problem however it seems like node.tag is breaking now ``` return key_value_function(filter(lambda node: node.tag == child_tag, tree.nodes)[0]) AttributeError: 'str' object has...
The only thing I tweaked is removing the first return line: ``` def child_key_value(child_tag): if isinstance(child_tag, dict): child_tag = next(iter(child_tag.keys())) **return key_value_function(tree.filter_nodes(lambda node: node.tag == child_tag)[0])** return key_value_function(filter(lambda node: node.tag...
thanks a lot it works now!
It seems to work for the first level but not recursively on all children, running this: ``` from treelib import Node, Tree from pprint import pprint import json tree =...
I am also seeing a similar error using ionic: TypeError: undefined is not a function (evaluating 'window.requestFileSystem(Helpers.getCordovaStorageType(ImgCache.options.usePersistentCache), 0, _gotFS, _fail)') I have followed the all the steps in the docs...