Closed khardix closed 8 years ago
The AttributeError: 'ListComprehension' object has no attribute 'parent'
is a jedi problem and should be reported upstream /cc @davidhalter. The fact that it brings down the server is strange and I will look into it this weekend. Thanks for the report :+1:
The fact that it brings down the server is strange
Actually the server do not crash. In fact if you remove the if response.
part and type again requests.
you will get the completion so the only problem here is the bug in jedi itself. That being said I will close this bug since there is nothing I can do here. If I misunderstood something we can always re-open this. Thanks again :)
This bug is blocking my workflow with vim as I am unable to type - ycm dialog keeps showing up. Is there a quick workaround for ycm to keep trying to work, but not blocking my input?
@afiodorov what do you mean by "is blocking my input"? When I try it, I get the error at every keystroke, yes, but since the semantic completion is failing it falls back to identifier completion.
While the error is occurring, the b
, g
, k
, and u
keys are ignored. Do you have any hints on what might be causing this bug? It's stifling my productivity enough to motivate my fixing it.
It happens for me too. Relevant piece of code:
import requests
resp = requests.post('http://www.google.com')
resp.[cursor-here]
I'm aware this issue is closed but I would like to share what I found today for those who are bothered by this issue.
The bug associated with Jedi can be found here: https://github.com/davidhalter/jedi/issues/592, and very unfortunately it is not fixed yet and there is no clue about any schedule of fixing it.
However, the odd about this issue is that while YCM relies on Jedi as a backend for python completion and triggers the aforementioned bug, Jedi-vim is surprisingly unaffected, i.e. it gives the completion options without error.
I have looked at the codes of Jedi and Jedi-vim, and I think that Jedi-vim doesn't use Jedi for the completion but use vim's built-in omni-completion instead, but Jedi-vim does use Jedi for looking up the function signature and, of course, display the signature in vim. The function signature look-up functionality is kind of independent of the completion functionality so Jedi-vim won't trigger the bug. BUT my knowledge about vim-script and how vim works with python code is very limited, so I can be totally wrong about this explanation.
My suggestion as a workaround for this issue is just disable YCM for python file and use Jedi-vim instead. That being said, I would like to propose a feature request that YCM could follow the way Jedi-vim works so this issue can be solved temporarily before Jedi's bug is fixed.
As for the issue of "blocking the input", here is my explanation based on my experience and the suggestions. The reason why the error message blocks the input (typing) and requires user to press Enter key is that the error message cannot fit into vim's command line (the bottom space where user type in commands). If you make your window (probably terminal window) wide enough (a minimum of 95 columns for me), the error message won't appear at all (probably overwritten by the "-- INSERT --" indicator, the error itself will still be there and can be found in the YCM debug stderr output). Anther way around will be to set cmdheight=2
to avoid "hit-enter" prompt (:help cmdheight
). That being said, if you switch to Jedi-vim for python files, there will be no such error message in the first place.
However, the odd about this issue is that while YCM relies on Jedi as a backend for python completion and triggers the aforementioned bug, Jedi-vim is surprisingly unaffected, i.e. it gives the completion options without error.
I have looked at the codes of Jedi and Jedi-vim, and I think that Jedi-vim doesn't use Jedi for the completion but use vim's built-in omni-completion instead, but Jedi-vim does use Jedi for looking up the function signature and, of course, display the signature in vim. The function signature look-up functionality is kind of independent of the completion functionality so Jedi-vim won't trigger the bug. BUT my knowledge about vim-script and how vim works with python code is very limited, so I can be totally wrong about this explanation.
I can reproduce the same issue with jedi-vim. The plugin automatically sets the omnifunc to jedi#completions
. You can check this by running :set omnifunc?
in Vim. In your case, you are probably loading the plugin in an unexpected way and the default omnifunc is used: pythoncomplete#Complete
, which does not have the issue.
Thanks for your reply @micbou ! It's all my bad that I forgot the after/
directory. You are totally correct and once using jedi#completions
the same bug will be triggered.
Issue Prelude
Please complete these steps and check these boxes (by putting an
x
inside the brackets) before filing your issue:vim --version
.:YcmDebugInfo
.:YcmToggleLogs stderr
.Thank you for adhering to this process! It ensures your issue is resolved quickly and that neither your nor our time is needlessly wasted.
Issue Details
When working with python files, I'm getting
HTTPError: 500 Server Error: Internal Server Error for url: http://127.0.0.1:33284/completions
after every keystroke. The issue seems to be in the Jedi completer – in the stderr logs of JediHTTP, the traceback statesAttributeError: 'ListComprehension' object has no attribute 'parent'
.Command outputs
System (Fedora 23 x86_64 Workstation) and vim versions:
YCM relevant bits of vimrc:
YcmDebugInfo:
YCM itself is compiled using
-DUSE_PYTHON2=OFF
CMAKE flag.YcmToggleLogs stderr:
Minimal reproducer file:
The error starts to appear when trying to continue typing the last line.
JediHTTP stderr log: