Skip to content

Python 2.6 ElementTree breaks linting SyntaxError: expected path separator ([) #371

@peterjc

Description

@peterjc

Problem found with planemo lint and planemo shed_lint and something in my MIRA wrapper https://github.com/peterjc/galaxy_mira/blob/master/tools/mira3/mira.xml when using Python 2.6.

I can reproduce this on TravisCI (e.g. https://travis-ci.org/peterjc/galaxy_mira/jobs/89677153 with Python 2.6.9), and locally (Python 2.6.6):

$ planemo --version
planemo, version 0.19.1.dev0
$ planemo lint --report_level warn --fail_level error tools/mira3/
Linting tool /mnt/galaxy/repositories/galaxy_mira/tools/mira3/mira.xml
Traceback (most recent call last):
  File "/usr/bin/planemo", line 9, in <module>
    load_entry_point('planemo==0.19.1.dev0', 'console_scripts', 'planemo')()
  File "/usr/lib/python2.6/site-packages/click-4.1-py2.6.egg/click/core.py", line 664, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/click-4.1-py2.6.egg/click/core.py", line 644, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python2.6/site-packages/click-4.1-py2.6.egg/click/core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.6/site-packages/click-4.1-py2.6.egg/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python2.6/site-packages/click-4.1-py2.6.egg/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/click-4.1-py2.6.egg/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/usr/lib/python2.6/site-packages/click-4.1-py2.6.egg/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/planemo-0.19.1.dev0-py2.6.egg/planemo/commands/cmd_lint.py", line 42, in cli
    recursive=kwds["recursive"]
  File "/usr/lib/python2.6/site-packages/planemo-0.19.1.dev0-py2.6.egg/planemo/tool_lint.py", line 28, in lint_tools_on_path
    if not lint_xml(tool_xml, **lint_args):
  File "/usr/lib/python2.6/site-packages/planemo-0.19.1.dev0-py2.6.egg/planemo_ext/galaxy/tools/lint.py", line 12, in lint_xml
    lint_xml_with(lint_context, tool_xml, extra_modules)
  File "/usr/lib/python2.6/site-packages/planemo-0.19.1.dev0-py2.6.egg/planemo_ext/galaxy/tools/lint.py", line 24, in lint_xml_with
    lint_context.lint(name, value, tool_xml)
  File "/usr/lib/python2.6/site-packages/planemo-0.19.1.dev0-py2.6.egg/planemo_ext/galaxy/tools/lint.py", line 44, in lint
    lint_func(lint_target, self)
  File "/usr/lib/python2.6/site-packages/planemo-0.19.1.dev0-py2.6.egg/planemo_ext/galaxy/tools/linters/inputs.py", line 38, in lint_inputs
    booleans = find_list(conditional, "./param[@type='boolean']")
  File "/usr/lib/python2.6/site-packages/planemo-0.19.1.dev0-py2.6.egg/planemo_ext/galaxy/tools/linters/inputs.py", line 30, in find_list
    matching = elem.findall(expression)
  File "/usr/lib64/python2.6/xml/etree/ElementTree.py", line 355, in findall
    return ElementPath.findall(self, path)
  File "/usr/lib64/python2.6/xml/etree/ElementPath.py", line 198, in findall
    return _compile(path).findall(element)
  File "/usr/lib64/python2.6/xml/etree/ElementPath.py", line 176, in _compile
    p = Path(path)
  File "/usr/lib64/python2.6/xml/etree/ElementPath.py", line 93, in __init__
    "expected path separator (%s)" % (op or tag)
SyntaxError: expected path separator ([)

Apparently searching with the [@attribute] syntax is not supported in Python 2.6's ElementTree, possible work around here: http://stackoverflow.com/questions/15753714/elementtree-syntaxerror-expected-path-separator

This suggests 44f16ba triggered this (fix for #194), CC @erasche

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