I encountered a strange issue today where I got a stacktrace from Jedi, seemingly caused by missing module inference.
import mock
m = mock.Mock() # No completion for Mock
m.ass<tab> # Should show assert_called, ... But causes the errors below
# Same for type annotated functions
def foo(m: mock.Mock():
m.ass<tab>
From what I've gathered the mock library is not found by Jedi, even though the other pip installed libraries are including my local ones. I'm using a virtualenv from python -m venv, python version 3.6.1.
YcmDebugInfo:
Printing YouCompleteMe debug information...
-- Client logfile: /var/folders/v3/p6gmkp4j4rvbwgfrbh69d2040000gn/T/ycm_xpifluga.log
-- Server Python interpreter: /usr/local/opt/python/bin/python2.7
-- Server Python version: 2.7.13
-- Server has Clang support compiled in: True
-- Clang version: clang version 4.0.0 (tags/RELEASE_400/final)
-- No extra configuration file found
-- Python completer debug information:
-- JediHTTP running at: http://127.0.0.1:56632
-- JediHTTP process ID: 70710
-- JediHTTP executable: /Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTT
P/jedihttp.py
-- JediHTTP logfiles:
-- /var/folders/v3/p6gmkp4j4rvbwgfrbh69d2040000gn/T/jedihttp_56632_stdout_AdvgpF.log
-- /var/folders/v3/p6gmkp4j4rvbwgfrbh69d2040000gn/T/jedihttp_56632_stderr_UBJWsw.log
-- Python interpreter: /Users/maxno/.pyenv/shims/python
-- Server running at: http://127.0.0.1:56629
-- Server process ID: 70705
-- Server logfiles:
-- /var/folders/v3/p6gmkp4j4rvbwgfrbh69d2040000gn/T/ycmd_56629_stdout_yc23k10o.log
-- /var/folders/v3/p6gmkp4j4rvbwgfrbh69d2040000gn/T/ycmd_56629_stderr_dovqg4l3.log
Client log
Traceback (most recent call last):
File "/Users/maxno/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/base_request.py", line 214, in HandleServerException
yield
File "/Users/maxno/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/completion_request.py", line 54, in RawResponse
response = JsonFromFuture( self._response_future )
File "/Users/maxno/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/base_request.py", line 183, in JsonFromFuture
raise MakeServerException( response.json() )
ycmd.responses.ServerError: HTTPError: 500 Server Error: Internal Server Error for url: http://127.0.0.1:56632/completions
2017-06-16 14:01:57,531 - ERROR - Error while handling server response
Traceback (most recent call last):
File "/Users/maxno/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/base_request.py", line 214, in HandleServerException
yield
File "/Users/maxno/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/completion_request.py", line 59, in RawResponse
raise MakeServerException( e )
ycmd.responses.ServerError: HTTPError: 500 Server Error: Internal Server Error for url: http://127.0.0.1:56632/completions
Jedi stderr log
Traceback (most recent call last):
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/bottle/bottle.py", line 862, in _handle
return route.call(**args)
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/bottle/bottle.py", line 1732, in wrapper
rv = callback(*a, **ka)
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/jedihttp/hmac_plugin.py", line 58, in wrapper
body = callback( *args, **kwargs )
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/jedihttp/handlers.py", line 84, in completions
response = _FormatCompletions( script.completions() )
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/api/__init__.py", line 179, in completions
completions = completion.completions()
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/api/completion.py", line 101, in completions
return sorted(completions, key=lambda x: (x.name.startswith('__'),
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/api/completion.py", line 40, in filter_names
len(like_name)
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/api/classes.py", line 407, in __init__
super(Completion, self).__init__(evaluator, name)
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/api/classes.py", line 67, in __init__
self._module = name.get_root_context()
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/filters.py", line 23, in get_root_context
return self.parent_context.get_root_context()
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/instance.py", line 295, in parent_context
return self._instance.create_instance_context(self.class_context, self.tree_name)
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/cache.py", line 41, in wrapper
rv = function(obj, *args, **kwargs)
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/instance.py", line 158, in create_instance_context
parent_context = self.create_instance_context(class_context, scope)
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/cache.py", line 41, in wrapper
rv = function(obj, *args, **kwargs)
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/instance.py", line 169, in create_instance_context
raise NotImplementedError
NotImplementedError
YCM stderr log
2017-06-16 14:01:57,307 - INFO - Received completion request
2017-06-16 14:01:57,314 - INFO - Starting new HTTP connection (1): 127.0.0.1
Traceback (most recent call last):
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 861, in _handle
return route.call(**args)
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 1734, in wrapper
rv = callback(*a, **ka)
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/watchdog_plugin.py", line 108, in wrapper
return callback( *args, **kwargs )
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/hmac_plugin.py", line 70, in wrapper
body = callback( *args, **kwargs )
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 103, in GetCompletions
.ComputeCandidates( request_data ) )
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/completer.py", line 217, in ComputeCandidates
candidates = self._GetCandidatesFromSubclass( request_data )
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/completer.py", line 233, in _GetCandidatesFromSubclass
raw_completions = self.ComputeCandidatesInner( request_data )
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/python/jedi_completer.py", line 270, in ComputeCandidatesInner
for completion in self._JediCompletions( request_data ) ]
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/python/jedi_completer.py", line 275, in _JediCompletions
request_data )[ 'completions' ]
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/python/jedi_completer.py", line 213, in _GetResponse
response.raise_for_status()
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/requests/requests/models.py", line 840, in raise_for_status
raise HTTPError(http_error_msg, response=self)
HTTPError: 500 Server Error: Internal Server Error for url: http://127.0.0.1:56632/completions
2017-06-16 14:01:57,509 - INFO - Received event notification
2017-06-16 14:01:57,513 - INFO - Received completion request
2017-06-16 14:01:57,515 - INFO - Starting new HTTP connection (1): 127.0.0.1
2017-06-16 14:01:57,528 - ERROR - Exception from semantic completer (using general): Traceback (most recent call last):
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 103, in GetCompletions
.ComputeCandidates( request_data ) )
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/completer.py", line 217, in ComputeCandidates
candidates = self._GetCandidatesFromSubclass( request_data )
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/completer.py", line 233, in _GetCandidatesFromSubclass
raw_completions = self.ComputeCandidatesInner( request_data )
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/python/jedi_completer.py", line 270, in ComputeCandidatesInner
for completion in self._JediCompletions( request_data ) ]
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/python/jedi_completer.py", line 275, in _JediCompletions
request_data )[ 'completions' ]
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/python/jedi_completer.py", line 213, in _GetResponse
response.raise_for_status()
File "/Users/maxno/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/requests/requests/models.py", line 840, in raise_for_status
raise HTTPError(http_error_msg, response=self)
HTTPError: 500 Server Error: Internal Server Error for url: http://127.0.0.1:56632/completions
2017-06-16 14:01:57,712 - INFO - Received completion request
2017-06-16 14:01:57,901 - INFO - Received event notification
2017-06-16 14:01:57,902 - INFO - Adding ONE buffer identifier for file: /Users/maxno/Code/referanza/import_contacts/tests/mock_assertion.py
2017-06-16 14:01:58,153 - INFO - Received completion request
2017-06-16 14:01:58,909 - INFO - Received event notification
2017-06-16 14:01:58,910 - INFO - Adding buffer identifiers for file: /Users/maxno/Code/referanza/import_contacts/tests/mock_assertion.py
2017-06-16 14:01:58,913 - INFO - Received event notification
2017-06-16 14:02:10,174 - INFO - Received debug info request
Ok, now it started to work, and I have no idea why. I leave it open for review, but if you want to close this, go right ahead.
I'll mark it as a bug for now, because that NotImplementedError still exists, even if it doesn't cause any problems anymore for you.
It came back and then disappeared after I commented. Schr枚dingers bugs are the worst.
Well, since it's a NotImplementedError, it's kind of documented in Jedi itself. It was expected that someone would stumble over it, we just never got around fixing it.
Thanks for the report. Will be fixed in the next release.