Skip to content

Subs file isn't checked for odd non-ascii characters #3

@jhill1

Description

@jhill1

Add the ascii replacer to the import subs file function. Otherwise, you get:

***Error: Failed sbstituting taxa due to unknown error. File a bug report, please!
https://github.com/supertree-toolkit/stk/issues

Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/supertree_toolkit-2.0-py2.7.egg/EGG-INFO/scripts/stk", line 1012, in sub_taxa
XML = supertree_toolkit.substitute_taxa(XML,old_taxa,new_taxa,ignoreWarnings=ignoreWarnings,only_existing=only_existing,generic_match=generic)
File "/usr/local/lib/python2.7/dist-packages/supertree_toolkit-2.0-py2.7.egg/EGG-INFO/scripts/../../stk/supertree_toolkit.py", line 472, in substitute_taxa
XML = stk_phyml.swap_tree_in_XML(XML,new_tree,name)
File "/usr/local/lib/python2.7/dist-packages/supertree_toolkit-2.0-py2.7.egg/EGG-INFO/scripts/../../stk/stk_phyml.py", line 785, in swap_tree_in_XML
t.xpath("tree/tree_string/string_value")[0].text = tree
File "src/lxml/lxml.etree.pyx", line 1031, in lxml.etree._Element.text.set (src/lxml/lxml.etree.c:55347)
File "src/lxml/apihelpers.pxi", line 711, in lxml.etree._setNodeText (src/lxml/lxml.etree.c:24667)
File "src/lxml/apihelpers.pxi", line 699, in lxml.etree._createTextNode (src/lxml/lxml.etree.c:24516)
File "src/lxml/apihelpers.pxi", line 1439, in lxml.etree._utf8 (src/lxml/lxml.etree.c:32441)
ValueError: All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters

PS - FIX the typo in the error message

Also, when loading via the GUI, got:
Traceback (most recent call last):
File "/home/jh1889/work/software/supertree-toolkit/autotree/stk_gui/bin/../stk_gui/interface.py", line 2203, in on_import_subs_clicked
dialogs.error_tb(self.main_window,"Error importing sub file:\n"+error)
NameError: global name 'error' is not defined

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions