-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Language service fails when using Python 2.7 interpreter #2017
Comments
Specific Python? Works on Windows & Ubuntu. Might be threading issue - is it consistent when you flip between interpreters? If you can, attach to dotnet.exe from VSC (.NET Core Attach in C# extension), as in https://github.com/Microsoft/vscode-python/blob/master/CONTRIBUTING%20-%20PYTHON_ANALYSIS.md#debugging-c-code-in-python-analysis-engine. |
I have a project (under an NDA unfortunately) where I can trigger this with 100% success (or, should I say, 100% failure). I'll try to isolate a package that triggers it or trace the ptvs code if time permits. |
todo @DonJayamanne |
Works prefect in Python3 but not 2.7 >.< |
JS stack trace
|
@MikhailArkhipov Does this work on Python 2.7 for you? |
C# stack trace
|
Yes, but this probably code specific scenario. I will add null check. |
Guessing it's in here: public override bool Equals(object obj) {
if (obj is BuiltinNamespace<MemberContainerType> bn && GetType() == bn.GetType()) {
return _type.Equals(bn._type);
}
return false;
} IIRC, |
OK |
I'm having the same problem with Python 2.7 (I think it affect all my codes) but also with 3.6.5/3.7.0 in some cases. For at least a project I get
with Python 3 (from pyenv on macOS). The |
I'm no longer able to replicate this issue. |
Still showing up for me. |
$ code --version
>> 1.25.1
>> 1dfc5e557209371715f655691b1235b6b26a06be
>> x64 I'm with ubuntu 16.04 |
I've spent the entire evening debugging the language server in Visual Studio 2017 (btw, the docs are out of date). I was not able to attach to the process quick enough as it crashed during initialization. In the end I've resorted to adding This allowed me to discover which part of the code causes the crash. It turns out that to reproduce it's enough to Now to the problem itself: I'm not yet sure why but the language server visits It then breaks when trying to import the The analyzer is not set until after known type loading is complete: I can prevent it from crashing (but can't say if/what else become broken by this workaround) by calling |
I know why it ends up parsing if sys.version_info[0] < 3:
from __builtin__ import *
# Overwrite any old definitions with the equivalent future.builtins ones:
from future.builtins import * |
Paging @brettcannon, @MikhailArkhipov and @zooba as I don't think I can fix it on my own. |
I have the same error. |
@patrys thanks for digging into this! The folks who can help with this are currently out on vacation so it might take them a little while to get around to this. |
Experiencing the same issue.. all my python 2.7 project is not able to run .. |
Same error, expect fixed soon. |
Please vote on the issue instead of writing "me too". |
@patrys - if you uncomment // #define WAIT_FOR_DEBUGGER in AnalysisVsc/Program.cs the process will wait until you attach the debugger. |
The same issue happened to me. I've tried to fix it and finally I know that how can it be resolved:
I thought that the previous setting for Python is not compatible with the latest one. Hope above is helpful to someone who suffers from the same issue. |
@hyunghunny Your workaround works by effectively removing the |
Based on your last message regarding "python.jediEnabled", I have just inserted the following statement into User Settings and Workspace Settings and I still get the error message: |
Update: |
This still fails for me even if I have removed my |
@albireox it doesn't have any fixes yet. @PeterSorrell do realize we don't have official support for IronPython. |
@brettcannon - fix is in LS, we can rev up insiders build. |
Don't know if this will work for others, but I turned the jediEnabled setting off and then on(so first to false and then back to true) and now it is working. Good luck! |
@norheim - the bug was a thread race condition so it may work sometimes. If it was consistent, we'd seen it before :-) |
For people bumping up against this issue, if you install a development build of the extension then it will download a newer version of the language server which should have a fix in it. (Even if you already have a development build installed, please uninstall it and install a newer copy as we updated the URL that the language server is downloaded from.) |
confirm: after installation of development build (vsix) the problem disappeared. GJ! |
@MikhailArkhipov
The text was updated successfully, but these errors were encountered: