puremourning / vimspector

vimspector - A multi-language debugging system for Vim
http://puremourning.github.io/vimspector-web
Apache License 2.0
4.08k stars 171 forks source link

windows neovim cannot add watch variable (error at self.expression[ 'frameId' ] = frame[ 'id' ]) #824

Closed igorzhilin closed 7 months ago

igorzhilin commented 8 months ago

Description

when adding a watch variable in windows nvim, it gives a python error ending with

self.expression[ 'frameId' ] = frame[ 'id' ]
TypeError: 'NoneType' object is not subscriptable

Is it reproducible in vim?

Only broken in Neovim

Works with clean config?

No

Sample project works?

Not reproducible with sample project

Minimal Reproduction

List of steps to reproduce:

  1. on Windows 10 OS

  2. Install neovim 0.9.5 winget install Neovim.Neovim

  3. Install nvim kickstart git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\

  4. pip3 install pynvim

  5. Add plugin 'puremourning/vimspector' to %userprofile%\AppData\Local\nvim\init.lua inside clause require('lazy').setup({:

    {
    "puremourning/vimspector"
    },
  6. Open nvim

  7. Run :VimspectorInstall debugpy

  8. Create .vimspector.json file in current dir:

    {
    "configurations": {
    "Python": {
      "adapter": "debugpy",
      "configuration": {
        "request": "launch",
        "cwd": "${fileDirname}",
        "program": "${file}"
      }
    }
    }
    }
  9. Create 'sample.py' file in current dir:

    my_variable = 0
    print(my_variable)
  10. :call vimspector#Launch()

  11. Click "Add" under vimspector.Variables and enter watch expression: my_variable image

  12. Get the error

    ...
    self.expression[ 'frameId' ] = frame[ 'id' ]
    TypeError: 'NoneType' object is not subscriptable

    image

Full error:

Error detected while processing function vimspector#internal#neowinbar#Do[1]..provider#python3#Call:
line   18:
Error invoking 'python_execute' on channel 5 (python3-script-host):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\i\AppData\Local\nvim-data\lazy\vimspector\python3\vimspector\utils.py", line 987, in DoWinBarAction
    vim.command( f':call { action }' )
  File "C:\Users\i\AppData\Local\Programs\Python\Python38\lib\site-packages\pynvim\api\nvim.py", line 311, in command
    return self.request('nvim_command', string, **kwargs)
  File "C:\Users\i\AppData\Local\Programs\Python\Python38\lib\site-packages\pynvim\api\nvim.py", line 199, in request
    res = self._session.request(name, *args, **kwargs)
  File "C:\Users\i\AppData\Local\Programs\Python\Python38\lib\site-packages\pynvim\msgpack_rpc\session.py", line 139, in request
    raise self.error_wrapper(err)
pynvim.api.common.NvimError: function vimspector#internal#neowinbar#Do[1]..provider#python3#Call[18]..vimspector#internal#neowinbar#Do[1]..vimspector#AddWatch[16]..provider#python3#Call, line 18: Vim(return):Error invoking 'python_execute' on channel 5 (python3-script-host):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\i\AppData\Local\nvim-data\lazy\vimspector\python3\vimspector\debug_session.py", line 60, in wrapper
    return fct( active_session, *args, **kwargs )
  File "C:\Users\i\AppData\Local\nvim-data\lazy\vimspector\python3\vimspector\debug_session.py", line 86, in wrapper
    return fct( self, *args, **kwargs )
  File "C:\Users\i\AppData\Local\nvim-data\lazy\vimspector\python3\vimspector\debug_session.py", line 1023, in AddWatch
    self._variablesView.AddWatch( self._connection,
  File "C:\Users\i\AppData\Local\nvim-data\lazy\vimspector\python3\vimspector\variables.py", line 499, in AddWatch
    self.EvaluateWatches( connection, frame )
  File "C:\Users\i\AppData\Local\nvim-data\lazy\vimspector\python3\vimspector\variables.py", line 528, in EvaluateWatches
    watch.SetCurrentFrame( fallback_connection, current_frame )
  File "C:\Users\i\AppData\Local\nvim-data\lazy\vimspector\python3\vimspector\variables.py", line 179, in SetCurrentFrame
    self.expression[ 'frameId' ] = frame[ 'id' ]
TypeError: 'NoneType' object is not subscriptable

Expected Behaviour

add variable

Actual Behaviour

python error at self.expression[ 'frameId' ] = frame[ 'id' ]

Additional information

No response

Installation Type

Plugin Manager (git clone)

Vimspector version

7390842315.0.0

Debug Info

No response

Log file

No response

Vim version

NVIM v0.9.2

Python version

No response

Neovim diagnostics

No response

Operating System

windows 10

Declaration

puremourning commented 8 months ago

Hmmm. Does this also happen in vim? Could you please supply logs?On 10 Jan 2024, at 13:08, igorzhilin @.***> wrote: Description when adding a watch variable in windows nvim, it gives a python error ending with self.expression[ 'frameId' ] = frame[ 'id' ] TypeError: 'NoneType' object is not subscriptable

Is it reproducible in vim? Only broken in Neovim Works with clean config? No Sample project works? Not reproducible with sample project Minimal Reproduction List of steps to reproduce:

on Windows 10 OS Install neovim 0.9.5 winget install Neovim.Neovim Install nvim kickstart git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\ pip3 install pynvim Add plugin 'puremourning/vimspector' to %userprofile%\AppData\Local\nvim\init.lua inside clause require('lazy').setup({:

{ "puremourning/vimspector" },

Open nvim Run :VimspectorInstall debugpy Create .vimspector.json file in current dir:

{ "configurations": { "Python": { "adapter": "debugpy", "configuration": { "request": "launch", "cwd": "${fileDirname}", "program": "${file}" } } } }

Create 'sample.py' file in current dir:

my_variable = 0 print(my_variable)

:call vimspector#Launch()

Click "Add" under vimspector.Variables and enter watch expression: my_variable image.png (view on web)

Get the error

... self.expression[ 'frameId' ] = frame[ 'id' ] TypeError: 'NoneType' object is not subscriptable

image.png (view on web) Full error: Error detected while processing function vimspector#internal#neowinbar#Do[1]..provider#python3#Call: line 18: Error invoking 'python_execute' on channel 5 (python3-script-host): Traceback (most recent call last): File "", line 1, in File "C:\Users\i\AppData\Local\nvim-data\lazy\vimspector\python3\vimspector\utils.py", line 987, in DoWinBarAction vim.command( f':call { action }' ) File "C:\Users\i\AppData\Local\Programs\Python\Python38\lib\site-packages\pynvim\api\nvim.py", line 311, in command return self.request('nvim_command', string, kwargs) File "C:\Users\i\AppData\Local\Programs\Python\Python38\lib\site-packages\pynvim\api\nvim.py", line 199, in request res = self._session.request(name, *args, *kwargs) File "C:\Users\i\AppData\Local\Programs\Python\Python38\lib\site-packages\pynvim\msgpack_rpc\session.py", line 139, in request raise self.error_wrapper(err) pynvim.api.common.NvimError: function vimspector#internal#neowinbar#Do[1]..provider#python3#Call[18]..vimspector#internal#neowinbar#Do[1]..vimspector#AddWatch[16]..provider#python3#Call, line 18: Vim(return):Error invoking 'python_execute' on channel 5 (python3-script-host): Traceback (most recent call last): File "", line 1, in File "C:\Users\i\AppData\Local\nvim-data\lazy\vimspector\python3\vimspector\debug_session.py", line 60, in wrapper return fct( active_session, args, kwargs ) File "C:\Users\i\AppData\Local\nvim-data\lazy\vimspector\python3\vimspector\debug_session.py", line 86, in wrapper return fct( self, *args, **kwargs ) File "C:\Users\i\AppData\Local\nvim-data\lazy\vimspector\python3\vimspector\debug_session.py", line 1023, in AddWatch self._variablesView.AddWatch( self._connection, File "C:\Users\i\AppData\Local\nvim-data\lazy\vimspector\python3\vimspector\variables.py", line 499, in AddWatch self.EvaluateWatches( connection, frame ) File "C:\Users\i\AppData\Local\nvim-data\lazy\vimspector\python3\vimspector\variables.py", line 528, in EvaluateWatches watch.SetCurrentFrame( fallback_connection, current_frame ) File "C:\Users\i\AppData\Local\nvim-data\lazy\vimspector\python3\vimspector\variables.py", line 179, in SetCurrentFrame self.expression[ 'frameId' ] = frame[ 'id' ] TypeError: 'NoneType' object is not subscriptable

Expected Behaviour add variable Actual Behaviour python error at self.expression[ 'frameId' ] = frame[ 'id' ] Additional information No response Installation Type Plugin Manager (git clone) Vimspector version 7390842315.0.0 Debug Info No response Log file No response Vim version NVIM v0.9.2

Python version No response Neovim diagnostics No response Operating System windows 10 Declaration

I have read and understood CONTRIBUTING.md I have read and understood the CODE_OF_CONDUCT.md

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

igorzhilin commented 7 months ago

The log that I see with :VimspectorToggleLog is as follows:

Enter watch expression: my_variableError detected while processing function vimspector#AddWatch[16]..provider#python3#Call:
line   18:
Error invoking 'python_execute' on channel 38 (python3-script-host):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\i\AppData\Local\nvim-data\lazy\vimspector\python3\vimspector\debug_session.py", line 60, in wrapper
    return fct( active_session, *args, **kwargs )
  File "C:\Users\i\AppData\Local\nvim-data\lazy\vimspector\python3\vimspector\debug_session.py", line 86, in wrapper
    return fct( self, *args, **kwargs )
  File "C:\Users\i\AppData\Local\nvim-data\lazy\vimspector\python3\vimspector\debug_session.py", line 1023, in AddWatch
    self._variablesView.AddWatch( self._connection,
  File "C:\Users\i\AppData\Local\nvim-data\lazy\vimspector\python3\vimspector\variables.py", line 499, in AddWatch
    self.EvaluateWatches( connection, frame )
  File "C:\Users\i\AppData\Local\nvim-data\lazy\vimspector\python3\vimspector\variables.py", line 528, in EvaluateWatches
    watch.SetCurrentFrame( fallback_connection, current_frame )
  File "C:\Users\i\AppData\Local\nvim-data\lazy\vimspector\python3\vimspector\variables.py", line 179, in SetCurrentFrame
    self.expression[ 'frameId' ] = frame[ 'id' ]
TypeError: 'NoneType' object is not subscriptable
igorzhilin commented 7 months ago

I need to note, however, that despite the error, python debugging on windows is working. I am able to add a breakpoint, start the debugging, and it correctly displays my_variable in the watches.

image

So it's not that big of an issue. I'll just keep this information here in case somebody gets the same error with vimspector on Windows.