Visual Studio Code – Python – List Index Limit Max 300 – Debugger
Question:
Answers:
You want to find a file named pydevd_resolver.py
under your Visual Studio Code workspace directory
(you can find it with Bash this command: find / -name pydevd_resolver.py 2>/dev/null
).
Open the file, and inside it look for a constant definition: MAX_ITEMS_TO_HANDLE = 300
. You can change this number to whatever you like, but please note this will of course consume more resources, so be careful with this.
Just for the sake of completion, I paste the note provided above this definition in pydevd_resolver.py
itself:
Note: 300 is already a lot to see in the outline (after that the user should really use the shell to get things) and this also means we’ll pass less information to the client side (which makes debugging faster).
I would advise using the debug console to manually poke and prod your data versus trying to look at all of it at once if it’s that large and requires editing internal code to the debugger. The limit is there for a reason and so going past it could leave to issues.
For the windows!
You can edit that file, pydevd_resolver.py
, at:
USER_NAME.vscodeextensionsms-python.python-2021.3.680753044pythonFileslibpythondebugpy_vendoredpydevd_pydevd_bundle
It works for me.
I attach VSCode to a running docker container, and I should edit the file at:
/root/.vscode-server/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_resolver.py
inside that docker container to make it work.
Another option: you can edit the .vscode/launch.json
file and add an environment variable to increase this number like this:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"env": {
"PYDEVD_CONTAINER_RANDOM_ACCESS_MAX_ITEMS": "1000",
...
},
...
}
]
}
You want to find a file named pydevd_resolver.py
under your Visual Studio Code workspace directory
(you can find it with Bash this command: find / -name pydevd_resolver.py 2>/dev/null
).
Open the file, and inside it look for a constant definition: MAX_ITEMS_TO_HANDLE = 300
. You can change this number to whatever you like, but please note this will of course consume more resources, so be careful with this.
Just for the sake of completion, I paste the note provided above this definition in pydevd_resolver.py
itself:
Note: 300 is already a lot to see in the outline (after that the user should really use the shell to get things) and this also means we’ll pass less information to the client side (which makes debugging faster).
I would advise using the debug console to manually poke and prod your data versus trying to look at all of it at once if it’s that large and requires editing internal code to the debugger. The limit is there for a reason and so going past it could leave to issues.
For the windows!
You can edit that file, pydevd_resolver.py
, at:
USER_NAME.vscodeextensionsms-python.python-2021.3.680753044pythonFileslibpythondebugpy_vendoredpydevd_pydevd_bundle
It works for me.
I attach VSCode to a running docker container, and I should edit the file at:
/root/.vscode-server/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_resolver.py
inside that docker container to make it work.
Another option: you can edit the .vscode/launch.json
file and add an environment variable to increase this number like this:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"env": {
"PYDEVD_CONTAINER_RANDOM_ACCESS_MAX_ITEMS": "1000",
...
},
...
}
]
}