Issue
Given a simple python program like
import numpy as np
my_list = [1,2,3,4,5]
my_array = np.array(my_list)
I can now use break points and the debugger to watch the variables
I can also expand them
for a list it shows all the elements neatly listed. This is esspecially helpful if I want to look at nested lists. However for the array it does not expand like it does for the list. It used to do it in the past. I can expand for example the T
variable but it just expands into itself. Like I get the same thing as when I expanded the array in the first place. Alos I can repeat that endlessly
This all started when I had to switch to the pre-relases version of the Python extension. I've switched back now, but it didn't helped.
My VS Code is:
Version: 1.85.0 (user setup)
Commit: af28b32d7e553898b2a91af498b1fb666fdebe0c
Date: 2023-12-06T20:48:09.019Z
Electron: 25.9.7
ElectronBuildId: 25551756
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.19045
Also this wierd error messages started to show up at the same time, as the behavior of the debugger changed, aka when I had to switch to the pre-relases version of the Python extension. So maybe they are related to this problem.
2023-12-15 11:41:41.416 [info] [Error - 11:41:41 AM] Server initialization failed.
2023-12-15 11:41:41.417 [info] Message: Pending response rejected since connection got disposed
Code: -32097
2023-12-15 11:41:41.417 [info] [Info - 11:41:41 AM] Connection to server got closed. Server will restart.
2023-12-15 11:41:41.417 [info] true
2023-12-15 11:41:41.418 [info] [Error - 11:41:41 AM] Python Jedi client: couldn't create connection to server.
2023-12-15 11:41:41.418 [info] Message: Pending response rejected since connection got disposed
Code: -32097
2023-12-15 11:41:41.419 [info] [Error - 11:41:41 AM] Restarting server failed
2023-12-15 11:41:41.419 [info] Message: Pending response rejected since connection got disposed
Code: -32097
2023-12-15 11:41:41.419 [info] [Error - 11:41:41 AM] Server process exited with code 1.
2023-12-15 11:41:41.797 [info] Traceback (most recent call last):
File "c:\Users\felix\.vscode\extensions\ms-python.python-2023.22.1\pythonFiles\run-jedi-language-server.py", line 9, in <module>
from jedi_language_server.cli import cli
File "c:\Users\felix\.vscode\extensions\ms-python.python-2023.22.1\pythonFiles\lib\jedilsp\jedi_language_server\__init__.py", line 5, in <module>
from importlib_metadata import version
File "c:\Users\felix\.vscode\extensions\ms-python.python-2023.22.1\pythonFiles\lib\jedilsp\importlib_metadata\__init__.py", line 6, in <module>
import zipp
File "c:\Users\felix\.vscode\extensions\ms-python.python-2023.22.1\pythonFiles\lib\jedilsp\zipp\__init__.py", line 9, in <module>
from .py310compat import text_encoding
File "c:\Users\felix\.vscode\extensions\ms-python.python-2023.22.1\pythonFiles\lib\jedilsp\zipp\py310compat.py", line 5
def _text_encoding(encoding, stacklevel=2, /): # pragma: no cover
^
SyntaxError: invalid syntax
2023-12-15 11:41:41.817 [info] [Error - 11:41:41 AM] Server process exited with code 1.
2023-12-15 11:41:41.819 [info] [Error - 11:41:41 AM] Server initialization failed.
2023-12-15 11:41:41.819 [info] Message: Pending response rejected since connection got disposed
Code: -32097
2023-12-15 11:41:41.819 [info] [Error - 11:41:41 AM] The Python Jedi server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
2023-12-15 11:41:41.819 [info] [Error - 11:41:41 AM] Python Jedi client: couldn't create connection to server.
2023-12-15 11:41:41.819 [info] Message: Pending response rejected since connection got disposed
Code: -32097
2023-12-15 11:41:41.819 [info] [Error - 11:41:41 AM] Restarting server failed
2023-12-15 11:41:41.819 [info] Message: Pending response rejected since connection got disposed
Code: -32097
Solution
This is/was a bug in debugpy: Can no longer expand Numpy arrays to view elements #1408 and namedtuple are not rendered in the variable browser as expected #1477. The bug was due to breakage from PR GH-1230 Use find_namespace_packages() #1374. It is fixed by PR Fix #1408, #1477 #1484. Sit tight and wait for the fix to be released.
For your reference / learning purposes, that issue ticket was found by googling "github vscode python issues debugger variables numpy array
".
Answered By - starball
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.