eaton-lab / toytree

A minimalist tree plotting library using toyplot graphs
http://eaton-lab.org/toytree
BSD 3-Clause "New" or "Revised" License
169 stars 28 forks source link

invalid mode when loading tree in Python 3.11.* #73

Closed dmnfarrell closed 1 year ago

dmnfarrell commented 1 year ago

I get this error when trying to load a tree. This seems to happen with python 3.11 but works in version 3.10.

  File ".venv/lib/python3.11/site-packages/toytree/Toytree.py", line 70, in __init__
    self.treenode = TreeParser(newick, tree_format).treenodes[0]
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.11/site-packages/toytree/TreeParser.py", line 80, in __init__
    self._run()
  File ".venv/lib/python3.11/site-packages/toytree/TreeParser.py", line 87, in _run
    self.get_data_from_intree()
  File ".venv/lib/python3.11/site-packages/toytree/TreeParser.py", line 136, in get_data_from_intree
    with open(self.intree, 'rU') as indata:
         ^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid mode: 'rU'
StuntsPT commented 1 year ago

This was already fixed in version 2.0.5 (at least), via 296a6a6. Just update toytree to the latest version, and you should be fine. =-)