-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Treelib not working any longer on Google colab or https://jupyter.org/ #218
Comments
I had the same problem, it is since this change: 8cd2940 . Something with encoding is weird here. My current workaround: # old, both giving the weird encoding
tree.show()
print(tree.show())
# new
print(tree.show(stdout=False)) This bypasses the forced encoding of UTF-8: Lines 931 to 934 in 7e1daf1
|
Same problem here, although not related Colab or Jupyter in any way. For me it doesn't work in VS Code, Python 3.9.13. I downgraded to 1.6.4 and all is good again. The workaround from @realjanpaulus is not acceptable to me, because newlines are not displayed in output which means the whole tree is printed as one line, defeating the purpose of the function. |
First save tree using tree.save2file("tree.txt") |
Hi,
I was already using the library and really enjoyed.
But now it is not working any longer.
Im am using the code:
`%pip install treelib
from treelib import Node, Tree
tree = Tree()
tree.create_node("Harry", "harry") # root node
tree.create_node("Jane", "jane", parent="harry")
tree.create_node("Bill", "bill", parent="harry")
tree.create_node("Diane", "diane", parent="jane")
tree.create_node("Mary", "mary", parent="diane")
tree.create_node("Mark", "mark", parent="jane")
tree.show()
The result is:
b'Harry\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Bill\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 Jane\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Diane\n \xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 Mary\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 Mark\n'`Was there an update? Why does it not work any longer?
thanks regards,
Mario
The text was updated successfully, but these errors were encountered: