Whenever I invoke the "Sort Import" from the Visual Studio Code command palette, I get an exception stack trace:
Traceback (most recent call last): File "/Users/absingh/.vscode/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py", line 30, in <module>
The stack trace of the exception is:
Traceback (most recent call last):
File "/Users/absingh/.vscode/extensions/ms-python.python-2020.10.332292344/pythonFiles/pyvsc-run-isolated.py", line 30, in <module>
Error 2020-11-04 12:15:45: runpy.run_path(module, run_name="__main__")
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 252, in run_path
return _run_module_code(code, init_globals, run_name, path_name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 82, in _run_module_code
mod_name, mod_fname, mod_loader, pkg_name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/Users/absingh/.vscode/extensions/ms-python.python-2020.10.332292344/pythonFiles/sortImports.py", line 12, in <module>
import isort.main
File "/Users/absingh/.vscode/extensions/ms-python.python-2020.10.332292344/pythonFiles/lib/python/isort/__init__.py", line 2, in <module>
from . import settings
File "/Users/absingh/.vscode/extensions/ms-python.python-2020.10.332292344/pythonFiles/lib/python/isort/settings.py", line 31
FILE_SKIP_COMMENTS: Tuple[str, ...] = (
^
SyntaxError: invalid syntax
I tried switching the Language Server, but it does not help.
Steps to reproduce:
- Open a python script with multiple import lines in VS Code:
import sys import os from pprint import pprint
- Open command palette by pressing [Command] + [Shift] + [p]
- Search for "Sort Import"
- Select and execute the command