dreadatour / Flake8Lint

Sublime Text plugin for lint Python files
233 stars 58 forks source link

Vendored elementtree breaks CodeComplice #75

Closed jcugat closed 8 years ago

jcugat commented 9 years ago

The vendored version of element tree (inside /contrib/elementtree) breaks the CodeComplice plugin:

Traceback (most recent call last):
  File "./threading.py", line 901, in _bootstrap_inner
  File "./threading.py", line 858, in run
  File "/Users/myuser/Library/Application Support/Sublime Text 3/Packages/CodeComplice/CodeComplice.py", line 831, in _codeintel_scan
    mgr = codeintel_manager()
  File "/Users/myuser/Library/Application Support/Sublime Text 3/Packages/CodeComplice/CodeComplice.py", line 792, in codeintel_manager
    db_import_everything_langs=None,
  File "/Users/myuser/Library/Application Support/Sublime Text 3/Packages/CodeComplice/libs/codeintel2/manager.py", line 139, in __init__
    self._register_modules(extra_module_dirs)
  File "/Users/myuser/Library/Application Support/Sublime Text 3/Packages/CodeComplice/libs/codeintel2/manager.py", line 197, in _register_modules
    self._register_module(module_path)
  File "/Users/myuser/Library/Application Support/Sublime Text 3/Packages/CodeComplice/libs/codeintel2/manager.py", line 279, in _register_module
    module = imp.load_module(module_name, *iinfo)
  File "./imp.py", line 180, in load_module
  File "./imp.py", line 119, in load_source
  File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
  File "<frozen importlib._bootstrap>", line 1022, in load_module
  File "<frozen importlib._bootstrap>", line 1003, in load_module
  File "<frozen importlib._bootstrap>", line 560, in module_for_loader_wrapper
  File "<frozen importlib._bootstrap>", line 868, in _load_module
  File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
  File "/Users/myuser/Library/Application Support/Sublime Text 3/Packages/CodeComplice/libs/codeintel2/lang_html.py", line 50, in <module>
    from codeintel2.lang_xml import XMLLangIntel
  File "/Users/myuser/Library/Application Support/Sublime Text 3/Packages/CodeComplice/libs/codeintel2/lang_xml.py", line 54, in <module>
    import koXMLTreeService
  File "/Users/myuser/Library/Application Support/Sublime Text 3/Packages/CodeComplice/libs/koXMLTreeService.py", line 488, in <module>
    import HTMLTreeParser
  File "/Users/myuser/Library/Application Support/Sublime Text 3/Packages/CodeComplice/libs/HTMLTreeParser.py", line 43, in <module>
    from elementtree import ElementTree
  File "/Users/myuser/Library/Application Support/Sublime Text 3/Packages/Python Flake8 Lint/contrib/elementtree/ElementTree.py", line 826, in <module>
    def _escape_cdata(text, encoding=None, replace=string.replace):
AttributeError: 'module' object has no attribute 'replace'

It seems CodeComplice is trying to load the version from Flake8Lint instead of the default one. I fixed it locally removing the folder /contrib/elementtree, but I'm not sure if it's needed for some reason.

Any idea how to fix it?

Vektrat commented 9 years ago

Would be cool if you could take a look at this when you got time I can confirm @jcugat 's fix works.

Thanks

dreadatour commented 8 years ago

Fixed in https://github.com/dreadatour/Flake8Lint/releases/tag/2.4.1