microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.94k stars 29.18k forks source link

{$file} ignored when launging python debugger for current file #224487

Closed irm-codebase closed 3 months ago

irm-codebase commented 3 months ago

Type: Bug

As the title says: when I set a launch.json file and try to debug my code (selecting "with launch.json", VScode returns:

[Errno 2] No such file or directory: 'home/[myusername]/.local/lib

This is making debugging code outside mine (justMyCode=false) impossible, and is very annoying. What's going on?

Note: I use conda, and I have correctly selected my interpreter to be conda.

VS Code version: Code 1.91.1 (f1e16e1e6214d7c44d078b1f0607b2388f29d729, 2024-07-09T22:08:12.169Z) OS version: Linux x64 6.9.11-200.fc40.x86_64 Modes:

System Info |Item|Value| |---|---| |CPUs|13th Gen Intel(R) Core(TM) i7-13700H (20 x 400)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|1, 1, 1| |Memory (System)|15.25GB (8.81GB free)| |Process Argv|| |Screen Reader|no| |VM|0%| |DESKTOP_SESSION|gnome| |XDG_CURRENT_DESKTOP|GNOME| |XDG_SESSION_DESKTOP|gnome| |XDG_SESSION_TYPE|wayland|
Extensions (32) Extension|Author (truncated)|Version ---|---|--- markdown-mermaid|bie|1.23.1 catppuccin-vsc|Cat|3.15.0 catppuccin-vsc-icons|Cat|1.13.0 ruff|cha|2024.36.0 file-tree-to-text-generator|d-k|1.4.0 vscode-markdownlint|Dav|0.55.0 EditorConfig|Edi|0.16.4 remotehub|Git|0.62.0 vscode-drawio|hed|1.6.6 compareit|in4|0.0.2 mypy|mat|0.3.1 rainbow-csv|mec|3.12.0 git-graph|mhu|1.30.0 debugpy|ms-|2024.8.0 python|ms-|2024.13.2024073102 vscode-pylance|ms-|2024.7.1 jupyter|ms-|2024.6.0 jupyter-keymap|ms-|1.1.2 jupyter-renderers|ms-|1.0.19 vscode-jupyter-cell-tags|ms-|0.1.9 vscode-jupyter-slideshow|ms-|0.1.6 remote-ssh|ms-|0.112.0 remote-ssh-edit|ms-|0.86.0 azure-repos|ms-|0.38.0 remote-explorer|ms-|0.4.3 remote-repositories|ms-|0.40.0 autodocstring|njp|0.6.1 vscode-yaml|red|1.15.0 snakemake-lang|sna|0.1.8 code-spell-checker|str|3.0.1 code-spell-checker-british-english|str|1.4.10 even-better-toml|tam|0.19.2
karthiknadig commented 3 months ago

@irm-codebase Please share your configuration? There is also a setting that you can use, for just my code. you don't have to specify it in the launch.json.

image

Just to make sure, it should be "program":"${file}" and not "program":"{$file}"

irm-codebase commented 3 months ago

@karthiknadig sorry, that was a typo. I'm using the correct command.

I tried running the debugger even without the launch.json file, and it still fails. Oddly enough, just running the file works perfectly... no idea what's going on.

Here is the config I've been using

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python Debugger: Current File",
            "type": "debugpy",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": false
        }
    ]
}
irm-codebase commented 3 months ago

Here is a picture of the error. Probably not super useful. I can look for stuff in the callstack if need be. image

irm-codebase commented 3 months ago

@karthiknadig Found the reason why the debugger was not working: setting "debugpy.debugJustMyCode": false IS the cause of the issue above! Basically:

roblourens commented 3 months ago

Please file the issue on the python debug extension repo, thanks