Visual Studio Code: Fixing Python Intellisense
Today my colleague, Dmitry Efremov, got an issue after installing the latest VSCode and Python extension - intellisense plainly stopped working for all packages except few very basic.
After enabling logging for the extension ("python.devOptions": ["DEBUG"] in user settings), it turned out that jedi, tool used for intellisense, fails with the next message in the output:
After modifying onjayamanne.python-0.3.17/pythonFiles/jedi/cache.py to print some debug info, it turned out that the problem was in the cache which the newer version of extension or jedi did not properly clean up.
So the solution turned out to be to clear the cache:
After enabling logging for the extension ("python.devOptions": ["DEBUG"] in user settings), it turned out that jedi, tool used for intellisense, fails with the next message in the output:
---------------------------
stderr jediProxy
Error (stderr) Traceback (most recent call last):
File "completion.py", line 313, in watch
self._process_request(self._input.readline())
File "completion.py", line 294, in _process_request
script.goto_assignments(), request['id']))
File "/home/dmitry/.vscode/extensions/donjayamanne.python-0.3.17/pythonFiles/jedi/api/__init__.py", line 382, in goto_assignments
results = self._goto()
File "/home/dmitry/.vscode/extensions/donjayamanne.python-0.3.17/pythonFiles/jedi/api/__init__.py", line 438, in _goto
definitions = self._evaluator.goto(name)
File "/home/dmitry/.vscode/extensions/donjayamanne.python-0.3.17/pythonFiles/jedi/evaluate/__init__.py", line 354, in goto
modules = imports.ImportWrapper(self, name).follow(is_goto=True)
File "/home/dmitry/.vscode/extensions/donjayamanne.python-0.3.17/pythonFiles/jedi/evaluate/cache.py", line 41, in wrapper
rv = function(obj, args, *kwargs)
File "/home/dmitry/.vscode/extensions/donjayamanne.python-0.3.17/pythonFiles/jedi/evaluate/imports.py", line 94, in follow
types = importer.follow()
File "/home/dmitry/.vscode/extensions/donjayamanne.python-0.3.17/pythonFiles/jedi/evaluate/cache.py", line 41, in wrapper
rv = function(obj, args, *kwargs)
File "/home/dmitry/.vscode/extensions/donjayamanne.python-0.3.17/pythonFiles/jedi/evaluate/imports.py", line 252, in follow
return self._do_import(self.import_path, self.sys_path_with_modifications())
File "/home/dmitry/.vscode/extensions/donjayamanne.python-0.3.17/pythonFiles/jedi/evaluate/imports.py", line 281, in _do_import
bases = self._do_import(import_path[:-1], sys_path)
File "/home/dmitry/.vscode/extensions/donjayamanne.python-0.3.17/pythonFiles/jedi/evaluate/imports.py", line 347, in _do_import
module = _load_module(self._evaluator, module_path, source, sys_path)
File "/home/dmitry/.vscode/extensions/donjayamanne.python-0.3.17/pythonFiles/jedi/evaluate/imports.py", line 449, in _load_module
cached = cache.load_parser(path)
File "/home/dmitry/.vscode/extensions/donjayamanne.python-0.3.17/pythonFiles/jedi/cache.py", line 210, in load_parser
return ParserPickling.load_parser(path, p_time)
File "/home/dmitry/.vscode/extensions/donjayamanne.python-0.3.17/pythonFiles/jedi/cache.py", line 267, in load_parser
parser_cache_item = pickle.load(f)
AttributeError: 'module' object has no attribute 'ParserWithRecovery'
After modifying onjayamanne.python-0.3.17/pythonFiles/jedi/cache.py to print some debug info, it turned out that the problem was in the cache which the newer version of extension or jedi did not properly clean up.
So the solution turned out to be to clear the cache:
rm -rf ~/.cacheSolved!
Comments
Post a Comment