Skip to content

Language service fails when using Python 2.7 interpreter #2017

Closed

Description

  • Open a workspace with Python code
  • Select Python 2.7 interpreter
  • Error message is displayed, see below

screen shot 2018-06-20 at 9 22 30 am

Mikhail Arkhipov (@MikhailArkhipov)

Activity

  1. added
    bugIssue identified by VS Code Team member as probable bug
    area-intellisenseLSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.
    on Jun 20, 2018
  2. changed the title [-]Language service fails when opening PTVSd project with Python 2.7 interpreter[/-] [+]Language service fails when opening PTVSD project with Python 2.7 interpreter[/+] on Jun 20, 2018
  3. changed the title [-]Language service fails when opening PTVSD project with Python 2.7 interpreter[/-] [+]Language service fails when using Python 2.7 interpreter[/+] on Jun 20, 2018
  4. MikhailArkhipov commented on Jun 20, 2018

    @MikhailArkhipov

    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.

  5. patrys commented on Jun 20, 2018

    @patrys

    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.

  6. DonJayamanne commented on Jun 20, 2018

    @DonJayamanne
    Author

    If you can, attach to dotnet.exe from VSC (.NET Core Attach in C# extension), as in /CONTRIBUTING%20-%20PYTHON_ANALYSIS.md@master#debugging-c-code-in-python-analysis-engine.

    todo Don Jayamanne (@DonJayamanne)

  7. MilkyHearts commented on Jun 26, 2018

    @MilkyHearts

    Works prefect in Python3 but not 2.7 >.<

  8. patrys commented on Jun 27, 2018

    @patrys
    JS stack trace
    Object reference not set to an instance of an object.: Error: Object reference not set to an instance of an object.
        at new ResponseError (/Users/patrys/.vscode-insiders/extensions/ms-python.python-2018.6.0/node_modules/vscode-jsonrpc/lib/messages.js:46:28)
        at handleResponse (/Users/patrys/.vscode-insiders/extensions/ms-python.python-2018.6.0/node_modules/vscode-jsonrpc/lib/main.js:430:48)
        at processMessageQueue (/Users/patrys/.vscode-insiders/extensions/ms-python.python-2018.6.0/node_modules/vscode-jsonrpc/lib/main.js:258:17)
        at Immediate.<anonymous> (/Users/patrys/.vscode-insiders/extensions/ms-python.python-2018.6.0/node_modules/vscode-jsonrpc/lib/main.js:242:13)
        at runCallback (timers.js:672:20)
        at tryOnImmediate (timers.js:645:5)
        at processImmediate [as _immediateCallback] (timers.js:617:5)
    
    Value cannot be null.
    Parameter name: type: Error: Value cannot be null.
    Parameter name: type
        at new ResponseError (/Users/patrys/.vscode-insiders/extensions/ms-python.python-2018.6.0/node_modules/vscode-jsonrpc/lib/messages.js:46:28)
        at handleResponse (/Users/patrys/.vscode-insiders/extensions/ms-python.python-2018.6.0/node_modules/vscode-jsonrpc/lib/main.js:430:48)
        at processMessageQueue (/Users/patrys/.vscode-insiders/extensions/ms-python.python-2018.6.0/node_modules/vscode-jsonrpc/lib/main.js:258:17)
        at Immediate.<anonymous> (/Users/patrys/.vscode-insiders/extensions/ms-python.python-2018.6.0/node_modules/vscode-jsonrpc/lib/main.js:242:13)
        at runCallback (timers.js:672:20)
        at tryOnImmediate (timers.js:645:5)
        at processImmediate [as _immediateCallback] (timers.js:617:5)
    
  9. DonJayamanne commented on Jun 27, 2018

    @DonJayamanne
    Author

    Mikhail Arkhipov (@MikhailArkhipov) Does this work on Python 2.7 for you?

  10. patrys commented on Jul 11, 2018

    @patrys
    C# stack trace
    [Error - 12:45:42] System.NullReferenceException: Object reference not set to an instance of an object.
       at Microsoft.PythonTools.Analysis.Values.BuiltinNamespace`1.Equals(Object obj)
       at System.Linq.Enumerable.All[TSource](IEnumerable`1 source, Func`2 predicate)
       at Microsoft.PythonTools.Analysis.AnalysisValue.Microsoft.PythonTools.Analysis.IAnalysisSet.Union(IEnumerable`1 items, Boolean canMutate)
       at Microsoft.PythonTools.Analysis.AnalysisValueSetExtensions.GetMember(IAnalysisSet self, Node node, AnalysisUnit unit, String name)
       at Microsoft.PythonTools.Analysis.Values.LazyValueInfo.ResolveOnce(AnalysisUnit unit, ResolutionContext context, Boolean& cacheResult)
       at Microsoft.PythonTools.Analysis.Values.LazyValueInfo.Resolve(AnalysisUnit unit, ResolutionContext context)
       at Microsoft.PythonTools.Analysis.AnalysisValueSetExtensions.Resolve(IAnalysisSet self, AnalysisUnit unit, ResolutionContext context, Boolean& changed)
       at Microsoft.PythonTools.Analysis.Values.LazyValueInfo.Resolve(AnalysisUnit unit, ResolutionContext context)
       at Microsoft.PythonTools.Analysis.AnalysisValueSetExtensions.Resolve(IAnalysisSet self, AnalysisUnit unit, ResolutionContext context, Boolean& changed)
       at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.AssignTo(Node assignStmt, Expression left, IAnalysisSet values)
       at Microsoft.PythonTools.Analysis.Analyzer.DDG.Walk(AssignmentStatement node)
       at Microsoft.PythonTools.Parsing.Ast.AssignmentStatement.Walk(PythonWalker walker)
       at Microsoft.PythonTools.Analysis.Analyzer.DDG.Walk(SuiteStatement node)
       at Microsoft.PythonTools.Parsing.Ast.SuiteStatement.Walk(PythonWalker walker)
       at Microsoft.PythonTools.Analysis.Analyzer.DDG.Walk(TryStatement node)
       at Microsoft.PythonTools.Parsing.Ast.TryStatement.Walk(PythonWalker walker)
       at Microsoft.PythonTools.Analysis.Analyzer.DDG.Walk(SuiteStatement node)
       at Microsoft.PythonTools.Parsing.Ast.SuiteStatement.Walk(PythonWalker walker)
       at Microsoft.PythonTools.Analysis.Analyzer.FunctionAnalysisUnit.AnalyzeWorker(DDG ddg, CancellationToken cancel)
       at Microsoft.PythonTools.Analysis.Analyzer.DDG.Analyze(Deque`1 queue, CancellationToken cancel, Action`1 reportQueueSize, Int32 reportQueueInterval)
       at Microsoft.PythonTools.Analysis.PythonAnalyzer.AnalyzeQueuedEntries(CancellationToken cancel)
       at Microsoft.PythonTools.Intellisense.AnalysisQueue.GroupAnalysis.Analyze(CancellationToken cancel)
       at Microsoft.PythonTools.Intellisense.AnalysisQueue.Worker(Object threadStarted)
    
  11. 27 remaining items

  12. patrys commented on Aug 3, 2018

    @patrys

    Please vote on the issue instead of writing "me too".

  13. MikhailArkhipov commented on Aug 6, 2018

    @MikhailArkhipov

    Patryk Zawadzki (@patrys) - if you uncomment

    // #define WAIT_FOR_DEBUGGER

    in AnalysisVsc/Program.cs the process will wait until you attach the debugger.

  14. hyunghunny commented on Aug 7, 2018

    @hyunghunny

    The same issue happened to me. I've tried to fix it and finally I know that how can it be resolved:

    • Closes the python project and deletes /.vscode under the project folder
    • Restarts VS Code and re-configure your python project.

    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.

  15. patrys commented on Aug 7, 2018

    @patrys

    Hyunghun Cho, Ph.D. (@hyunghunny) Your workaround works by effectively removing the python.jediEnabled setting. That's all you need to do, no need to delete entire folders. Unfortunately it does not fix anything, it just no longer uses the new language service (where the bug used to live).

  16. PeterSorrell commented on Aug 7, 2018

    @PeterSorrell

    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:
    {
    "python.pythonPath": "C:\Program Files\IronPython 2.7\ipy.exe",
    "python.jediEnabled": false,
    "python.linting.pylintEnabled": false
    }
    Any more news on a fix for this problem?
    Thanks.

  17. PeterSorrell commented on Aug 7, 2018

    @PeterSorrell

    Update:
    After the changes to User Settings and Workspace Settings I found that the debugger would not start, so I removed "python.jediEnabled": false, which made the debugger work again. Very strange!

  18. albireox commented on Aug 8, 2018

    @albireox

    This still fails for me even if I have removed my languageServer directory and forced the language server to be redownloaded. Is that expected? Maybe the version of the LS vscode-python is downloading doesn't incorporate those changes yet.

  19. brettcannon commented on Aug 8, 2018

    @brettcannon
    Member

    José Sánchez-Gallego (@albireox) it doesn't have any fixes yet.

    PeterSorrell do realize we don't have official support for IronPython.

  20. MikhailArkhipov commented on Aug 9, 2018

    @MikhailArkhipov

    Brett Cannon (@brettcannon) - fix is in LS, we can rev up insiders build.

  21. norheim commented on Aug 10, 2018

    @norheim

    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!

  22. MikhailArkhipov commented on Aug 10, 2018

    @MikhailArkhipov

    norheim - the bug was a thread race condition so it may work sometimes. If it was consistent, we'd seen it before :-)

  23. brettcannon commented on Aug 10, 2018

    @brettcannon
    Member

    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.)

  24. qyloxe commented on Aug 14, 2018

    @qyloxe

    confirm: after installation of development build (vsix) the problem disappeared. GJ!

  25. locked as resolved and limited conversation to collaborators on Sep 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-intellisenseLSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.bugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions