Open emilnewel opened 3 weeks ago
Related output from <cmd>DapShowLog
[ INFO ] 2024-06-25T09:06:20Z+0000 ] ...emil/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:754 ] "Telemetry" "ptvsd"
[ INFO ] 2024-06-25T09:06:20Z+0000 ] ...emil/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:754 ] "Telemetry" "debugpy"
[ WARN ] 2024-06-25T09:06:20Z+0000 ] ...emil/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1016 ] "No event handler for " {
body = {
sockets = { {
host = "127.0.0.1",
internal = false,
port = 51915
} }
},
event = "debugpySockets",
seq = 3,
type = "event"
}
[ WARN ] 2024-06-25T09:06:20Z+0000 ] ...emil/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1016 ] "No event handler for " {
body = {
sockets = { {
host = "127.0.0.1",
internal = false,
port = 51915
}, {
host = "127.0.0.1",
internal = true,
port = 51916
} }
},
event = "debugpySockets",
seq = 5,
type = "event"
}
[ WARN ] 2024-06-25T09:06:20Z+0000 ] ...emil/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1016 ] "No event handler for " {
body = {
sockets = { {
host = "127.0.0.1",
internal = false,
port = 51915
}, {
host = "127.0.0.1",
internal = true,
port = 51917
}, {
host = "127.0.0.1",
internal = true,
port = 51916
} }
},
event = "debugpySockets",
seq = 6,
type = "event"
}
[ WARN ] 2024-06-25T09:06:21Z+0000 ] ...emil/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1016 ] "No event handler for " {
body = {
sockets = { {
host = "127.0.0.1",
internal = false,
port = 51915
}, {
host = "127.0.0.1",
internal = true,
port = 51916
} }
},
event = "debugpySockets",
seq = 7,
type = "event"
}
[ WARN ] 2024-06-25T09:08:19Z+0000 ] ...emil/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1016 ] "No event handler for " {
body = {
sockets = { {
host = "127.0.0.1",
internal = false,
port = 51915
} }
},
event = "debugpySockets",
seq = 573,
type = "event"
}
[ WARN ] 2024-06-25T09:08:19Z+0000 ] ...emil/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1016 ] "No event handler for " {
body = {
sockets = {}
},
event = "debugpySockets",
seq = 574,
type = "event"
}
[ WARN ] 2024-06-25T09:08:19Z+0000 ] ...emil/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1016 ] "No event handler for " {
body = {
sockets = {}
},
event = "debugpySockets",
seq = 575,
type = "event"
}
[ ERROR ] 2024-06-25T09:08:20Z+0000 ] ...emil/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1466 ] "stderr" {
args = { "-m", "debugpy.adapter" },
command = "/Users/emil/.pyenv/versions/nvim-dap/bin/python",
enrich_config = <function 1>,
options = {
source_filetype = "python"
},
type = "executable"
} "Fatal Python error: _enter_buffered_busy: could not acquire lock for <_io.BufferedReader name='<stdin>'> at interpreter shutdown, possibly due to daemon threads\nPython runtime state: finalizing (tstate=0x0000000126e05bf0)\n"
[ ERROR ] 2024-06-25T09:08:20Z+0000 ] ...emil/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1466 ] "stderr" {
args = { "-m", "debugpy.adapter" },
command = "/Users/emil/.pyenv/versions/nvim-dap/bin/python",
enrich_config = <function 1>,
options = {
source_filetype = "python"
},
type = "executable"
} "\nCurrent thread 0x00000001f7388c00 (most recent call first):\n <no Python frame>\n"
[ INFO ] 2024-06-25T09:08:20Z+0000 ] ...emil/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1439 ] "Process closed" 98996
I got the same issue here. The venv doesn't seem to be found, modules installed with pip cannot be imported. When I step further the program crashes with an import error I can see in the UI that the python interpreter installed via pyenv is used directly and not the one from the venv inside the workspace.
I tried to force the use of the interpreter defined in the venv like
require("dap-python").setup(LazyVim.get_pkg_path("debugpy", "/venv/bin/python"), {
pythonPath = vim.fn.getcwd() .. "/.venv/bin/python",
})
When I do that it seem to find the modules installed with pip but then it is unable to import the modules from the very workspace I want to debug. I haven't been working on a python project for some months but I'm quite sure it was working before.
For some reason DAP can't figure out the correct pythonpath in my project. I can set breakpoints, see the UI, step a bit into my code but then the debugger stop when I hit the following line
when i run
<cmd>echo $PYTHONPATH
I getsrc/foo:src/bar:src/baz
.venv is set correctly as I can import and use packages installed with pip.
Everything works correctly in Pycharm/VSCode but I wanted to try to move everything over to nvim and this is the only piece of the configuration I have left.
My project structure
Dap configuration for python