Skip to content
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

Debugger: setting "justMyCode": false does not work in a Python 3.10 venv #139

Closed
k98kurz opened this issue Aug 14, 2023 · 17 comments
Closed
Assignees
Milestone

Comments

@k98kurz
Copy link

k98kurz commented Aug 14, 2023

Type: Bug

Behaviour

Expected vs. Actual

Expected: setting "justMyCode": false within the autogenerated launch.json file should allow the debugger to step through imported code.

Actual: setting "justMyCode": false within the autogenerated launch.json file results in the same "frame skipped" message that says to set "justMyCode": false within the autogenerated launch.json file.

Steps to reproduce:

  1. Create and use a python venv.
  2. Install a package via pip.
  3. Create a script, importing that package and calling a function from it.
  4. Debug and try to step into the package function call.
  5. See the "frame was skipped" message and set the "justMyCode" option to false in the launch.json file.
  6. See the "frame was skipped" message anyway because setting "justMyCode" to false does not work.

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.10.12
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
  • Value of the python.languageServer setting: Default
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

2023-08-13 23:50:01.241 [info] Experiment 'pythonPromptNewFormatterExt' is active
2023-08-13 23:50:01.241 [info] Experiment 'pythonPromptNewToolsExt' is active
2023-08-13 23:50:01.241 [info] Experiment 'pythonSurveyNotificationcf' is active
2023-08-13 23:50:01.241 [info] Experiment 'pythonTestAdapter' is active
2023-08-13 23:50:01.241 [info] VS Code was launched from an activated environment: 'venv2', selecting it as the interpreter for workspace.
2023-08-13 23:50:01.241 [info] Test server listening.
2023-08-13 23:50:01.318 [warning] Retry failed, storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS
2023-08-13 23:50:01.318 [warning] Retry failed, storage update failed for key PYTHON_WORKSPACE_STORAGE_KEYS
2023-08-13 23:50:01.318 [warning] Retry failed, storage update failed for key PYTHON_WORKSPACE_STORAGE_KEYS
2023-08-13 23:50:01.363 [info] > conda info --json
2023-08-13 23:50:01.412 [info] > ./venv2/bin/python -I ~/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/interpreterInfo.py
2023-08-13 23:50:01.433 [info] > ./venv/bin/python -I ~/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/interpreterInfo.py
2023-08-13 23:50:01.461 [info] Python interpreter path: ./venv2/bin/python
2023-08-13 23:50:01.532 [info] > . ./venv2/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/printEnvVariables.py
2023-08-13 23:50:01.532 [info] shell: bash
2023-08-13 23:50:01.533 [warning] Retry failed, storage update failed for key PYTHON_ENV_INFO_CACHE
2023-08-13 23:50:01.535 [warning] Retry failed, storage update failed for key PYTHON_ENV_INFO_CACHE
2023-08-13 23:50:01.535 [warning] Retry failed, storage update failed for key PYTHON_ENV_INFO_CACHE
2023-08-13 23:50:01.535 [warning] Retry failed, storage update failed for key PYTHON_ENV_INFO_CACHE
2023-08-13 23:50:01.535 [warning] Retry failed, storage update failed for key PYTHON_ENV_INFO_CACHE
2023-08-13 23:50:02.211 [warning] Retry failed, storage update failed for key PYTHON_ENV_INFO_CACHE
2023-08-13 23:50:02.230 [warning] Retry failed, storage update failed for key PYTHON_ENV_INFO_CACHE
2023-08-13 23:50:03.323 [info] Starting Pylance language server.
2023-08-13 23:50:17.132 [info] Discover tests for workspace name: tapescript-maths - uri: /home/usernameredacted/temp/tapescript-maths/run.py
2023-08-13 23:50:32.923 [info] Using launch configuration in workspace folder.
2023-08-13 23:50:33.155 [info] DAP Server launched with command: /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter
2023-08-13 23:50:33.320 [info] Send text to terminal: source /home/usernameredacted/temp/tapescript-maths/venv2/bin/activate
2023-08-13 23:50:34.589 [info] Send text to terminal:  /usr/bin/env /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 33839 -- /home/usernameredacted/temp/tapescript-maths/run.py 
2023-08-13 23:51:41.276 [info] DAP Server launched with command: /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter
2023-08-13 23:51:41.348 [info] Send text to terminal:  cd /home/usernameredacted/temp/tapescript-maths ; /usr/bin/env /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 49003 -- /home/usernameredacted/temp/tapescript-maths/run.py 
2023-08-13 23:52:00.391 [info] DAP Server launched with command: /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter
2023-08-13 23:52:00.493 [info] Send text to terminal:  cd /home/usernameredacted/temp/tapescript-maths ; /usr/bin/env /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 56031 -- /home/usernameredacted/temp/tapescript-maths/run.py 
2023-08-13 23:53:53.332 [info] Using launch configuration in launch.json file.
2023-08-13 23:53:53.533 [info] DAP Server launched with command: /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter
2023-08-13 23:53:53.609 [info] Send text to terminal:  cd /home/usernameredacted/temp/tapescript-maths ; /usr/bin/env /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 54021 -- /home/usernameredacted/temp/tapescript-maths/run.py 
2023-08-13 23:55:06.904 [info] DAP Server launched with command: /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter
2023-08-13 23:55:06.995 [info] Send text to terminal:  cd /home/usernameredacted/temp/tapescript-maths ; /usr/bin/env /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 55607 -- /home/usernameredacted/temp/tapescript-maths/run.py 
2023-08-13 23:56:19.203 [info] DAP Server launched with command: /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter
2023-08-13 23:56:19.292 [info] Send text to terminal:  cd /home/usernameredacted/temp/tapescript-maths ; /usr/bin/env /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 37621 -- /home/usernameredacted/temp/tapescript-maths/run.py 
2023-08-13 23:56:29.977 [info] Using launch configuration in launch.json file.
2023-08-13 23:56:30.152 [info] DAP Server launched with command: /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter
2023-08-13 23:56:30.421 [info] Send text to terminal: source /home/usernameredacted/temp/tapescript-maths/venv2/bin/activate
2023-08-13 23:56:31.443 [info] Send text to terminal:  /usr/bin/env /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 39985 -- /home/usernameredacted/temp/tapescript-maths/run.py 
2023-08-13 23:56:48.421 [info] Using launch configuration in launch.json file.
2023-08-13 23:56:48.606 [info] DAP Server launched with command: /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter
2023-08-13 23:56:48.680 [info] Send text to terminal:  cd /home/usernameredacted/temp/tapescript-maths ; /usr/bin/env /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 46123 -- /home/usernameredacted/temp/tapescript-maths/run.py 
2023-08-13 23:57:23.368 [info] Using launch configuration in launch.json file.
2023-08-13 23:57:23.581 [info] DAP Server launched with command: /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter
2023-08-13 23:57:23.653 [info] Send text to terminal:  cd /home/usernameredacted/temp/tapescript-maths ; /usr/bin/env /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 40395 -- /home/usernameredacted/temp/tapescript-maths/run.py 
2023-08-13 23:57:53.293 [info] Using launch configuration in launch.json file.
2023-08-13 23:57:53.487 [info] DAP Server launched with command: /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter
2023-08-13 23:57:53.562 [info] Send text to terminal:  cd /home/usernameredacted/temp/tapescript-maths ; /usr/bin/env /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 41769 -- /home/usernameredacted/temp/tapescript-maths/run.py 
2023-08-13 23:59:19.054 [info] Using launch configuration in launch.json file.
2023-08-13 23:59:19.238 [info] DAP Server launched with command: /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter
2023-08-13 23:59:19.309 [info] Send text to terminal:  cd /home/usernameredacted/temp/tapescript-maths ; /usr/bin/env /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 34801 -- /home/usernameredacted/temp/tapescript-maths/run.py 
2023-08-14 00:06:03.514 [info] Found: /bin/python --> /bin/python
2023-08-14 00:06:03.515 [info] Found: /bin/python3 --> /bin/python3.10
2023-08-14 00:06:03.515 [info] Found: /bin/python3.10 --> /bin/python3.10
2023-08-14 00:06:03.515 [info] Found: /bin/python3.11 --> /bin/python3.11
2023-08-14 00:06:03.543 [info] Found: /usr/bin/python --> /usr/bin/python
2023-08-14 00:06:03.543 [info] Found: /usr/bin/python3 --> /usr/bin/python3.10
2023-08-14 00:06:03.543 [info] Found: /usr/bin/python3.10 --> /usr/bin/python3.10
2023-08-14 00:06:03.543 [info] Found: /usr/bin/python3.11 --> /usr/bin/python3.11
2023-08-14 00:06:03.566 [info] Found: /home/usernameredacted/temp/tapescript-maths/venv2/bin/python --> /usr/bin/python3.10
2023-08-14 00:06:03.567 [info] Found: /home/usernameredacted/temp/tapescript-maths/venv2/bin/python3 --> /usr/bin/python3.10
2023-08-14 00:06:03.568 [info] Found: /home/usernameredacted/temp/tapescript-maths/venv2/bin/python3.10 --> /usr/bin/python3.10
2023-08-14 00:06:03.586 [info] > /bin/python -I ~/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/interpreterInfo.py
2023-08-14 00:06:03.606 [info] > /bin/python3 -I ~/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/interpreterInfo.py
2023-08-14 00:06:03.639 [info] > /bin/python3.11 -I ~/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/interpreterInfo.py
2023-08-14 00:06:03.693 [info] > /usr/bin/python -I ~/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/interpreterInfo.py
2023-08-14 00:06:03.762 [info] > /usr/bin/python3 -I ~/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/interpreterInfo.py
2023-08-14 00:06:03.791 [info] > /usr/bin/python3.11 -I ~/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/interpreterInfo.py
2023-08-14 00:06:21.554 [info] Discover tests for workspace name: tapescript-maths - uri: /home/usernameredacted/temp/tapescript-maths/run.py
2023-08-14 00:06:35.127 [info] Using launch configuration in launch.json file.
2023-08-14 00:06:35.318 [info] DAP Server launched with command: /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter
2023-08-14 00:06:35.571 [info] Send text to terminal: source /home/usernameredacted/temp/tapescript-maths/venv2/bin/activate
2023-08-14 00:06:36.593 [info] Send text to terminal:  /usr/bin/env /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 52509 -- /home/usernameredacted/temp/tapescript-maths/run.py 
2023-08-14 00:07:02.967 [info] Using launch configuration in launch.json file.
2023-08-14 00:07:03.150 [info] DAP Server launched with command: /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter
2023-08-14 00:07:03.368 [info] Send text to terminal: source /home/usernameredacted/temp/tapescript-maths/venv2/bin/activate
2023-08-14 00:07:04.393 [info] Send text to terminal:  /usr/bin/env /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 48405 -- /home/usernameredacted/temp/tapescript-maths/run.py 
2023-08-14 00:12:22.084 [info] Using launch configuration in launch.json file.
2023-08-14 00:12:22.265 [info] DAP Server launched with command: /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter
2023-08-14 00:12:22.521 [info] Send text to terminal: source /home/usernameredacted/temp/tapescript-maths/venv2/bin/activate
2023-08-14 00:12:23.543 [info] Send text to terminal:  /usr/bin/env /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 57813 -- /home/usernameredacted/temp/tapescript-maths/run.py 
2023-08-14 00:13:02.369 [info] Using launch configuration in launch.json file.
2023-08-14 00:13:02.562 [info] DAP Server launched with command: /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter
2023-08-14 00:13:02.635 [info] Send text to terminal:  cd /home/usernameredacted/temp/tapescript-maths ; /usr/bin/env /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 59641 -- /home/usernameredacted/temp/tapescript-maths/run.py 
2023-08-14 00:13:31.161 [info] Using launch configuration in launch.json file.
2023-08-14 00:13:31.334 [info] DAP Server launched with command: /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter
2023-08-14 00:13:31.406 [info] Send text to terminal:  cd /home/usernameredacted/temp/tapescript-maths ; /usr/bin/env /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 41041 -- /home/usernameredacted/temp/tapescript-maths/run.py 
2023-08-14 00:14:53.488 [info] Using launch configuration in launch.json file.
2023-08-14 00:14:53.672 [info] DAP Server launched with command: /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter
2023-08-14 00:14:53.747 [info] Send text to terminal:  cd /home/usernameredacted/temp/tapescript-maths ; /usr/bin/env /home/usernameredacted/temp/tapescript-maths/venv2/bin/python /home/usernameredacted/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 60763 -- /home/usernameredacted/temp/tapescript-maths/run.py 
2023-08-14 10:08:31.728 [info] Send text to terminal: source /home/usernameredacted/temp/tapescript-maths/venv2/bin/activate
2023-08-14 12:01:36.582 [info] Discover tests for workspace name: tapescript-maths - uri: /home/usernameredacted/temp/tapescript-maths/venv2/lib/python3.10/site-packages/~apescript/interfaces.py

User Settings


languageServer: "Pylance"

Extension version: 2023.14.0
VS Code version: Code 1.81.1 (6c3e3dba23e8fadc360aed75ce363ba185c49794, 2023-08-09T22:18:39.991Z)
OS version: Linux x64 6.2.0-26-generic snap
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz (8 x 3051)
GPU Status 2d_canvas: unavailable_software
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: disabled_software
multiple_raster_threads: enabled_on
opengl: disabled_off
rasterization: disabled_software
raw_draw: disabled_off_ok
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: unavailable_software
webgl2: unavailable_software
webgpu: disabled_off
Load (avg) 0, 1, 1
Memory (System) 31.20GB (25.15GB free)
Process Argv --no-sandbox --force-user-env --unity-launch --crash-reporter-id 8288fe70-1d22-4ecb-a399-2ca5eb4778fd
Screen Reader no
VM 0%
DESKTOP_SESSION ubuntu
XDG_CURRENT_DESKTOP Unity
XDG_SESSION_DESKTOP ubuntu
XDG_SESSION_TYPE wayland
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes516:30244333
vslsvsres303:30308271
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30410667
py29gd2263:30792226
vsclangdc:30486549
c4g48928:30535728
dsvsc012:30540252
pynewext54:30695312
azure-dev_surveyone:30548225
vsccc:30803844
3biah626:30602489
f6dab269:30613381
showlangstatbar:30737416
03d35959:30757346
pythonfmttext:30731395
pythoncmvfstrcf:30756944
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
gsofa:30804715
pythonnosmt12:30797651
pythonidxpt:30805730
pythonnoceb:30805159
dsvsc013:30795093
dsvsc014:30804076

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Aug 14, 2023
@k98kurz
Copy link
Author

k98kurz commented Aug 14, 2023

It it possible to get it to work by also adding "purpose": ["debug-in-terminal"], but since following the directions in the message did not work and this necessary part of the launch.json file was not included, it is still a bug that needs to be fixed: make the debugger work with the instructions provided to the user; or change how the launch.json file is autogenerated to work with the instructions provided to the user; or include an additional instruction to include the "purpose": ["debug-in-terminal"] in the "frame skipped" message. Whichever of the three can be done ought to be done, because the current behavior is obviously incorrect.

@karthiknadig
Copy link
Member

Debug and try to step into the package function call

Can you clarify where you are triggering this from? You can trigger debugging for 3 possible locations. The instructions vary based on which one you used. There is the button in the debug view, then there is "debug-in-terminal" button at the top of the open python file, then there is the debug menu item.

The debugger itself does not know how this was triggered, so the message generated only suggests a setting that it understands. For the debug-in-terminal case the settings are generated on the fly, if there isn't already a setting in the launch.json for this purpose (i.e., using the purpose flag).

The following feature should address this as it aims to provide a dedicated solution enabling justMyCode for all scenarios #116

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Aug 15, 2023
@k98kurz
Copy link
Author

k98kurz commented Aug 15, 2023

The debug button on the top right, next to the split panel button. The other two methods ("Python: Current file" in debug panel and Run > Start Debugging menu item) work as expected.

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Aug 15, 2023
@karthiknadig karthiknadig self-assigned this Aug 15, 2023
@tboddyspargo
Copy link

I wanted to chime in to say that I have been experiencing something similar on v2023.18.0 and v2023.20.0. It's been difficult to feel confident in what I'm experiencing and I'm afraid I still don't have a reliable minimal erpro, but my experience is basically:

Given the setup steps mentioned by @k98kurz.

  1. I use Debug Python File option with config setting justMyCode = false
  2. The first time after restarting/reloading VSCode, it works (I can step into 3rd party code).
  3. If I stop or let the debugging session finish, then use Debug Python File again, it behaves as though justMyCode = true

As a workaround, I have to restart VSCode constantly to make sure I can retain the ability to step into 3rd party code.

Apologies for not having a reliable repro a bit more fully formed. My hope is that the anecdote above will either be enough for a reproduction, or enough to know where to look for a likely cause in the code.

@tboddyspargo
Copy link

Quick update to say that I've also experienced this same "it works the first time and then doesn't work any subsequent times" using the Testing Explorer Debug Test option. In the situation I just encountered, my test does trigger a segmentation fault, although I'm not sure that's necessary for the reproduction.

@paulacamargo25 paulacamargo25 added this to the November 2023 milestone Nov 21, 2023
@paulacamargo25 paulacamargo25 transferred this issue from microsoft/vscode-python Nov 21, 2023
@paulacamargo25
Copy link
Contributor

paulacamargo25 commented Nov 21, 2023

When you trigger Debug Python File It only runs a launch config that have the "purpose": "debug-in-terminal". If not it doesn't use the launch.json file and returns a basic config. So if you want to use a specific config with this value, you need to add "purpose": "debug-in-terminal" to the specific configuration.

This issue can also be related to #137. Here you will be able to run the config that you want with this button.

@paulacamargo25 paulacamargo25 added bug Issue identified by VS Code Team member as probable bug feature-request Request for new features or functionality and removed triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Nov 21, 2023
@paulacamargo25 paulacamargo25 removed the feature-request Request for new features or functionality label Nov 21, 2023
@tboddyspargo
Copy link

If not it doesn't use the launch.json file and returns a basic config. So if you want to use a specific config with this value, you need to add "purpose": "debug-in-terminal" to the specific configuration.

In my reproductions with both Debug Python File and Debug Test, the purpose field is populated with debug-in-terminal and debug-test respectively. From what I'm seeing, justMyCode = false is lost after the first debug session is terminated. Restarting VSCode "resets" the usage counter, but it still reverts back to justMyCode = true behavior after one debug session has completed.

I'll test again once #138 merges to see if it's still reproducible and open a new issue if it is (to make sure the impact and repro are super clear). Thanks!

@brian316
Copy link

brian316 commented May 3, 2024

my configuration. adding justMyCode fails with exception. works perfectly fine without justMyCode but i want to put breakpoints in virtualenv libraries

[Errno 2] No such file or directory: '/home/dev/.local/lib/python3.10'
"configurations": [
        {
            "name": "Python Debugger: Current File",
            "type": "debugpy",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": false,
        }

@smasyutin
Copy link

I get the same as @brian316 with config (almost) from https://code.visualstudio.com/docs/python/testing#_debug-tests

        {
            "name": "Python: Debug Tests",
            "type": "debugpy",
            "request": "launch",
            "program": "${file}",
            "purpose": [
                "debug-test"
            ],
            "console": "integratedTerminal",
            "cwd": "${workspaceFolder}",
            "envFile": "${workspaceFolder}/.env",
            "justMyCode": false
        }

@brian316
Copy link

@smasyutin
I got it to work by removing these breakpoints in the debugger. when they are enabled on start it fails, but you can add them back after it has started
image

@jeskowagner
Copy link

Faced the same issue as @brian316, disabling the mentioned breakpoints fortunately fixes it for me too. Thanks for posting that workaround!

@sebgab
Copy link

sebgab commented Jul 12, 2024

Disabling the breakpoints mentioned by @brian316 worked for me as well. Thank you for the workaround!
No change to my launch.json required.

Some info about my issue.
Everything was working fine until it stopped working for seemingly no reason sometime this week.
I was using a python 3.10.10 venv, which I later upgraded to a python 3.12.4 venv on a Windows 11 computer.

Some info about the error messages I was getting:
The error I was getting with Python 3.12 was: [WinError 3] The system cannot find the path specified: '<PYTHON INSTALL DIR>\site-packages'

With Python 3.10 the error was: [WinError 2] The system cannot find the file specified: '<PYTHON INSTALL DIR>\\python310.zip'

It is worth noting that Python 3.10 was installed globally, and Python 3.12 was installed to my user account.

@ChihchengHsieh
Copy link

It's weird that @brian316 's method actually works without the need to touch launch.json at all.

@tboddyspargo
Copy link

I'm not having much luck with matching my breakpoint settings to those in #139 (comment). I'm in a multi-root/folder workspace and I've been suspicious that that may affect this behavior (perhaps due to the extension not mapping the virtual environment files correctly from the workspaceFolder relative path to the debugpy context?).

@tboddyspargo
Copy link

tboddyspargo commented Aug 22, 2024

UPDATE: I just tried setting debugpy.debugJustMyCode to false in one or both of my User and Workspace settings files and it has allowed be to step into library code without worrying about @brian316's breakpoint suggestion.

I had always been relying on the launch-configuration-level setting of justMyCode being set to false to be sufficient. Is the extension perhaps not merging the different levels of configs as expected and leading to the default debugpy.debugJustMyCode to trump the launch-configuration-level justMyCode when specified in .code-workspace files?

@ArthurHNL
Copy link

Just ran into this issue, I still can't launch with breakpoints enabled as indicated by @brian316. Could it be worthwhile to reopen this issue?

@Real-Gecko
Copy link

Have the same issue with Python 3.12 while running tests:

Image

VSCode: 1.95.1
Pylance: v2024.10.1
Extension: v2024.12.0

Might be related to microsoft/vscode-python#21249

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests