Repository navigation
Pyflakes out of date; breaks on Python 3.6 syntax with Python 3.6 interpreter #91
Copy link
Copy link
Open
Description
Activity
After adding this to server.py:
root = logging.getLogger() root.setLevel(logging.DEBUG) ch = logging.FileHandler('/tmp/sublimepython.log') ch.setLevel(logging.DEBUG) formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') ch.setFormatter(formatter) root.addHandler(ch)I was able to modify check_syntax to:
def check_syntax(self, code, encoding, lint_settings, filename): '''The linting mixin does not use the project_for machinery, but uses the linters directy.''' try: codes = do_linting(lint_settings, code, encoding, filename) except Exception: logging.exception('wtf') import traceback sys.stderr.write(traceback.format_exc())Which revealed:
Traceback (most recent call last): File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/xmlrpc/server.py", line 392, in _dispatch func = self.funcs[method] KeyError: 'check_syntax' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/BenJolitz/Library/Application Support/Sublime Text 3/Packages/SublimePythonIDE/server/server.py", line 335, in check_syntax codes = do_linting(lint_settings, code, encoding, filename) File "/Users/BenJolitz/Library/Application Support/Sublime Text 3/Packages/SublimePythonIDE/server/linter.py", line 123, in do_linting errors.extend(pyflakes_check(code, encoding, filename, pyflakes_ignore)) File "/Users/BenJolitz/Library/Application Support/Sublime Text 3/Packages/SublimePythonIDE/server/linter.py", line 44, in pyflakes_check w = pyflakes.Checker(tree, filename, builtins=ignore) File "/Users/BenJolitz/Library/Application Support/Sublime Text 3/Packages/SublimePythonIDE/server/../../SublimePythonIDE/pyflakes/checker.py", line 295, in __init__ self.runDeferred(self._deferredFunctions) File "/Users/BenJolitz/Library/Application Support/Sublime Text 3/Packages/SublimePythonIDE/server/../../SublimePythonIDE/pyflakes/checker.py", line 332, in runDeferred handler() File "/Users/BenJolitz/Library/Application Support/Sublime Text 3/Packages/SublimePythonIDE/server/../../SublimePythonIDE/pyflakes/checker.py", line 823, in runFunction self.handleNode(stmt, node) File "/Users/BenJolitz/Library/Application Support/Sublime Text 3/Packages/SublimePythonIDE/server/../../SublimePythonIDE/pyflakes/checker.py", line 609, in handleNode handler(node) File "/Users/BenJolitz/Library/Application Support/Sublime Text 3/Packages/SublimePythonIDE/server/../../SublimePythonIDE/pyflakes/checker.py", line 567, in handleChildren self.handleNode(node, tree) File "/Users/BenJolitz/Library/Application Support/Sublime Text 3/Packages/SublimePythonIDE/server/../../SublimePythonIDE/pyflakes/checker.py", line 609, in handleNode handler(node) File "/Users/BenJolitz/Library/Application Support/Sublime Text 3/Packages/SublimePythonIDE/server/../../SublimePythonIDE/pyflakes/checker.py", line 916, in TRY self.handleChildren(node, omit='body') File "/Users/BenJolitz/Library/Application Support/Sublime Text 3/Packages/SublimePythonIDE/server/../../SublimePythonIDE/pyflakes/checker.py", line 567, in handleChildren self.handleNode(node, tree) File "/Users/BenJolitz/Library/Application Support/Sublime Text 3/Packages/SublimePythonIDE/server/../../SublimePythonIDE/pyflakes/checker.py", line 609, in handleNode handler(node) File "/Users/BenJolitz/Library/Application Support/Sublime Text 3/Packages/SublimePythonIDE/server/../../SublimePythonIDE/pyflakes/checker.py", line 925, in EXCEPTHANDLER self.handleChildren(node) File "/Users/BenJolitz/Library/Application Support/Sublime Text 3/Packages/SublimePythonIDE/server/../../SublimePythonIDE/pyflakes/checker.py", line 567, in handleChildren self.handleNode(node, tree) File "/Users/BenJolitz/Library/Application Support/Sublime Text 3/Packages/SublimePythonIDE/server/../../SublimePythonIDE/pyflakes/checker.py", line 609, in handleNode handler(node) File "/Users/BenJolitz/Library/Application Support/Sublime Text 3/Packages/SublimePythonIDE/server/../../SublimePythonIDE/pyflakes/checker.py", line 567, in handleChildren self.handleNode(node, tree) File "/Users/BenJolitz/Library/Application Support/Sublime Text 3/Packages/SublimePythonIDE/server/../../SublimePythonIDE/pyflakes/checker.py", line 609, in handleNode handler(node) File "/Users/BenJolitz/Library/Application Support/Sublime Text 3/Packages/SublimePythonIDE/server/../../SublimePythonIDE/pyflakes/checker.py", line 567, in handleChildren self.handleNode(node, tree) File "/Users/BenJolitz/Library/Application Support/Sublime Text 3/Packages/SublimePythonIDE/server/../../SublimePythonIDE/pyflakes/checker.py", line 608, in handleNode handler = self.getNodeHandler(node.__class__) File "/Users/BenJolitz/Library/Application Support/Sublime Text 3/Packages/SublimePythonIDE/server/../../SublimePythonIDE/pyflakes/checker.py", line 462, in getNodeHandler self._nodeHandlers[node_class] = handler = getattr(self, nodeType) AttributeError: 'Checker' object has no attribute 'JOINEDSTR'Looks like pyflakes is out of date, as they've fixed that via PyCQA/pyflakes#80
Aaand the issue is solved by copying pyflakes/pyflakes HEAD into
SublimePythonIDE/pyflakes/. And confirmed.Pyflakes in this project is out of date and does not support Python3.6 syntax properly. By using an older pyflakes version, SublimePythonIDE breaks linting (silently) for Python 3 interpreters.
- changed the title
[-]Linter only shows issues if something clearly illegal is declared in Python 3/virtualenv[/-][+]Pyflakes out of date; breaks on Python 3.6 syntax with Python 3.6 interpreter[/+]on Jun 13, 2017
Metadata
Metadata
Assignees
Labels
No labels
I've a project config of:
When I remove
python_interpreter, the linter detects numerous issues like bad spacing, missing vars, etc,. Here is a sample where it should whine:When
python_interpreteris set to Python 3, it no longer complains. I'm a bit uncertain how to proceed as I depend on the linter keeping me honest. For now, I add in things like1=1to provoke the linter to do its job.