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

Using tmux split-window as external terminal in Python causes ModuleNotFoundError for local imports #1368

Open
rpop0 opened this issue Nov 18, 2024 · 6 comments

Comments

@rpop0
Copy link

rpop0 commented Nov 18, 2024

Debug adapter definition and debug configuration

Debugpy (1.8.8) installed via Mason

local dap = require('dap')
dap.defaults.fallback.external_terminal = {
    command = "tmux",
    args = { "split-window", "-h", "-d", "-p", "35" }
}

nvim-dap-python configuration:

local debugpyPath = require('mason-registry').get_package('debugpy'):get_install_path() .. "/venv/bin/python3"
require('dap-python').setup(debugpyPath, {
    console = "externalTerminal"
}

Debug adapter version

1.8.8

Steps to Reproduce

  1. Python project, local virtual env configured in .venv via virtualenv
  2. Venv and PYTHONPATH set to the root project directory
  3. In module, try to import from another local module using an absolute path

Expected Result

Everything runs fine

Actual Result

Debugger throws ModuleNotFoundError as soon as it hits local absolute import.

My config is set to open a tmux split and to use that as the console output. I noticed that this is what actually causes the problem of the imports. if I for example remove the console = "externalTerminal" line from the nvim-dap-python configuration, the local module gets imported just fine. The same happens if I remove the tmux configuration for the fallback terminal.

Should be noted that this has worked in the past.

[ INFO ] 2024-11-19T00:42:57Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:813 ]	"Telemetry"	"ptvsd"
[ INFO ] 2024-11-19T00:42:57Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:813 ]	"Telemetry"	"debugpy"
[ WARN ] 2024-11-19T00:42:57Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1092 ]	"No event handler for "	{
  body = {
    sockets = { {
        host = "127.0.0.1",
        internal = false,
        port = 39935
      } }
  },
  event = "debugpySockets",
  seq = 3,
  type = "event"
}
[ WARN ] 2024-11-19T00:42:57Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1092 ]	"No event handler for "	{
  body = {
    sockets = { {
        host = "127.0.0.1",
        internal = false,
        port = 39935
      }, {
        host = "127.0.0.1",
        internal = true,
        port = 52429
      } }
  },
  event = "debugpySockets",
  seq = 5,
  type = "event"
}
[ WARN ] 2024-11-19T00:42:57Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1092 ]	"No event handler for "	{
  body = {
    sockets = { {
        host = "127.0.0.1",
        internal = false,
        port = 39935
      }, {
        host = "127.0.0.1",
        internal = true,
        port = 42151
      }, {
        host = "127.0.0.1",
        internal = true,
        port = 52429
      } }
  },
  event = "debugpySockets",
  seq = 6,
  type = "event"
}
[ WARN ] 2024-11-19T00:42:58Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1092 ]	"No event handler for "	{
  body = {
    sockets = { {
        host = "127.0.0.1",
        internal = false,
        port = 39935
      }, {
        host = "127.0.0.1",
        internal = true,
        port = 52429
      } }
  },
  event = "debugpySockets",
  seq = 8,
  type = "event"
}
[ WARN ] 2024-11-19T00:43:01Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1092 ]	"No event handler for "	{
  body = {
    sockets = { {
        host = "127.0.0.1",
        internal = false,
        port = 39935
      } }
  },
  event = "debugpySockets",
  seq = 41,
  type = "event"
}
[ WARN ] 2024-11-19T00:43:01Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1092 ]	"No event handler for "	{
  body = {
    sockets = {}
  },
  event = "debugpySockets",
  seq = 42,
  type = "event"
}
[ WARN ] 2024-11-19T00:43:01Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1092 ]	"No event handler for "	{
  body = {
    sockets = {}
  },
  event = "debugpySockets",
  seq = 43,
  type = "event"
}
[ ERROR ] 2024-11-19T00:43:02Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1542 ]	"stderr"	{
  args = { "-m", "debugpy.adapter" },
  command = "/home/rpop/.local/share/nvim/mason/packages/debugpy/venv/bin/python3",
  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=0x00007f147b6a7ef8)\n\nCurrent thread 0x00007f147ae4ab80 (most recent call first):\n  <no Python frame>\n"
[ INFO ] 2024-11-19T00:43:02Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1515 ]	"Process closed"	16976
@mfussenegger
Copy link
Owner

Can you show the logs with trace logging enabled?

@rpop0
Copy link
Author

rpop0 commented Nov 22, 2024

Sure, here are the logs @mfussenegger


[ DEBUG ] 2024-11-22T22:25:00Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1463 ]	"Spawning debug adapter"	{
  args = { "-m", "debugpy.adapter" },
  command = "/home/rpop/.local/share/nvim/mason/packages/debugpy/venv/bin/python3",
  enrich_config = <function 1>,
  options = {
    source_filetype = "python"
  },
  type = "executable"
}
[ DEBUG ] 2024-11-22T22:25:00Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1775 ]	"request"	{
  arguments = {
    adapterID = "nvim-dap",
    clientID = "neovim",
    clientName = "neovim",
    columnsStartAt1 = true,
    linesStartAt1 = true,
    locale = "en_US.UTF-8",
    pathFormat = "path",
    supportsProgressReporting = true,
    supportsRunInTerminalRequest = true,
    supportsStartDebuggingRequest = true,
    supportsVariableType = true
  },
  command = "initialize",
  seq = 1,
  type = "request"
}
[ DEBUG ] 2024-11-22T22:25:00Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  body = {
    category = "telemetry",
    data = {
      packageVersion = "1.8.8"
    },
    output = "ptvsd"
  },
  event = "output",
  seq = 1,
  type = "event"
}
[ DEBUG ] 2024-11-22T22:25:00Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  body = {
    category = "telemetry",
    data = {
      packageVersion = "1.8.8"
    },
    output = "debugpy"
  },
  event = "output",
  seq = 2,
  type = "event"
}
[ INFO ] 2024-11-22T22:25:00Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:813 ]	"Telemetry"	"ptvsd"
[ DEBUG ] 2024-11-22T22:25:00Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  body = {
    sockets = { {
        host = "127.0.0.1",
        internal = false,
        port = 42375
      } }
  },
  event = "debugpySockets",
  seq = 3,
  type = "event"
}
[ INFO ] 2024-11-22T22:25:00Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:813 ]	"Telemetry"	"debugpy"
[ DEBUG ] 2024-11-22T22:25:00Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  body = {
    exceptionBreakpointFilters = { {
        default = false,
        description = "Break whenever any exception is raised.",
        filter = "raised",
        label = "Raised Exceptions"
      }, {
        default = true,
        description = "Break when the process is exiting due to unhandled exception.",
        filter = "uncaught",
        label = "Uncaught Exceptions"
      }, {
        default = false,
        description = "Break when exception escapes into library code.",
        filter = "userUnhandled",
        label = "User Uncaught Exceptions"
      } },
    supportsClipboardContext = true,
    supportsCompletionsRequest = true,
    supportsConditionalBreakpoints = true,
    supportsConfigurationDoneRequest = true,
    supportsDebuggerProperties = true,
    supportsDelayedStackTraceLoading = true,
    supportsEvaluateForHovers = true,
    supportsExceptionInfoRequest = true,
    supportsExceptionOptions = true,
    supportsFunctionBreakpoints = true,
    supportsGotoTargetsRequest = true,
    supportsHitConditionalBreakpoints = true,
    supportsLogPoints = true,
    supportsModulesRequest = true,
    supportsSetExpression = true,
    supportsSetVariable = true,
    supportsStepInTargetsRequest = true,
    supportsTerminateRequest = true,
    supportsValueFormattingOptions = true
  },
  command = "initialize",
  request_seq = 1,
  seq = 4,
  success = true,
  type = "response"
}
[ WARN ] 2024-11-22T22:25:00Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1092 ]	"No event handler for "	{
  body = {
    sockets = { {
        host = "127.0.0.1",
        internal = false,
        port = 42375
      } }
  },
  event = "debugpySockets",
  seq = 3,
  type = "event"
}
[ DEBUG ] 2024-11-22T22:25:00Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1775 ]	"request"	{
  arguments = {
    console = "externalTerminal",
    name = "Launch file",
    program = "/home/rpop/git/access-insights/access_insights/site_processor/blank_processor.py",
    pythonPath = "/home/rpop/git/access-insights/.venv/bin/python",
    request = "launch",
    type = "python"
  },
  command = "launch",
  seq = 2,
  type = "request"
}
[ DEBUG ] 2024-11-22T22:25:00Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  body = {
    sockets = { {
        host = "127.0.0.1",
        internal = false,
        port = 42375
      }, {
        host = "127.0.0.1",
        internal = true,
        port = 36861
      } }
  },
  event = "debugpySockets",
  seq = 5,
  type = "event"
}
[ WARN ] 2024-11-22T22:25:00Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1092 ]	"No event handler for "	{
  body = {
    sockets = { {
        host = "127.0.0.1",
        internal = false,
        port = 42375
      }, {
        host = "127.0.0.1",
        internal = true,
        port = 36861
      } }
  },
  event = "debugpySockets",
  seq = 5,
  type = "event"
}
[ DEBUG ] 2024-11-22T22:25:00Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  body = {
    sockets = { {
        host = "127.0.0.1",
        internal = false,
        port = 42375
      }, {
        host = "127.0.0.1",
        internal = true,
        port = 33159
      }, {
        host = "127.0.0.1",
        internal = true,
        port = 36861
      } }
  },
  event = "debugpySockets",
  seq = 6,
  type = "event"
}
[ WARN ] 2024-11-22T22:25:00Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1092 ]	"No event handler for "	{
  body = {
    sockets = { {
        host = "127.0.0.1",
        internal = false,
        port = 42375
      }, {
        host = "127.0.0.1",
        internal = true,
        port = 33159
      }, {
        host = "127.0.0.1",
        internal = true,
        port = 36861
      } }
  },
  event = "debugpySockets",
  seq = 6,
  type = "event"
}
[ DEBUG ] 2024-11-22T22:25:00Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  arguments = {
    args = { "/home/rpop/git/access-insights/.venv/bin/python", "/home/rpop/.local/share/nvim/mason/packages/debugpy/venv/lib/python3.11/site-packages/debugpy/launcher", "33159", "--", "/home/rpop/git/access-insights/access_insights/site_processor/blank_processor.py" },
    cwd = "/home/rpop/git/access-insights/access_insights/site_processor",
    env = vim.empty_dict(),
    kind = "external",
    title = "Python Debug Console"
  },
  command = "runInTerminal",
  seq = 7,
  type = "request"
}
[ DEBUG ] 2024-11-22T22:25:00Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:217 ]	"run_in_terminal"	{
  args = { "/home/rpop/git/access-insights/.venv/bin/python", "/home/rpop/.local/share/nvim/mason/packages/debugpy/venv/lib/python3.11/site-packages/debugpy/launcher", "33159", "--", "/home/rpop/git/access-insights/access_insights/site_processor/blank_processor.py" },
  cwd = "/home/rpop/git/access-insights/access_insights/site_processor",
  env = vim.empty_dict(),
  kind = "external",
  title = "Python Debug Console"
}
[ DEBUG ] 2024-11-22T22:25:00Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1805 ]	"response"	{
  body = {
    processId = 49940
  },
  command = "runInTerminal",
  request_seq = 7,
  seq = 3,
  success = true,
  type = "response"
}
[ DEBUG ] 2024-11-22T22:25:01Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  body = {
    sockets = { {
        host = "127.0.0.1",
        internal = false,
        port = 42375
      }, {
        host = "127.0.0.1",
        internal = true,
        port = 36861
      } }
  },
  event = "debugpySockets",
  seq = 8,
  type = "event"
}
[ WARN ] 2024-11-22T22:25:01Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1092 ]	"No event handler for "	{
  body = {
    sockets = { {
        host = "127.0.0.1",
        internal = false,
        port = 42375
      }, {
        host = "127.0.0.1",
        internal = true,
        port = 36861
      } }
  },
  event = "debugpySockets",
  seq = 8,
  type = "event"
}
[ DEBUG ] 2024-11-22T22:25:01Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  event = "initialized",
  seq = 9,
  type = "event"
}
[ DEBUG ] 2024-11-22T22:25:01Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1775 ]	"request"	{
  arguments = {
    breakpoints = { {
        line = 92
      } },
    lines = { 92 },
    source = {
      name = "blank_processor.py",
      path = "/home/rpop/git/access-insights/access_insights/site_processor/blank_processor.py"
    },
    sourceModified = false
  },
  command = "setBreakpoints",
  seq = 4,
  type = "request"
}
[ DEBUG ] 2024-11-22T22:25:01Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  body = {
    breakpoints = { {
        id = 0,
        line = 92,
        source = {
          name = "blank_processor.py",
          path = "/home/rpop/git/access-insights/access_insights/site_processor/blank_processor.py"
        },
        verified = true
      } }
  },
  command = "setBreakpoints",
  request_seq = 4,
  seq = 10,
  success = true,
  type = "response"
}
[ DEBUG ] 2024-11-22T22:25:01Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1775 ]	"request"	{
  arguments = {
    filters = { "uncaught" }
  },
  command = "setExceptionBreakpoints",
  seq = 5,
  type = "request"
}
[ DEBUG ] 2024-11-22T22:25:01Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  command = "setExceptionBreakpoints",
  request_seq = 5,
  seq = 11,
  success = true,
  type = "response"
}
[ DEBUG ] 2024-11-22T22:25:01Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1775 ]	"request"	{
  command = "configurationDone",
  seq = 6,
  type = "request"
}
[ DEBUG ] 2024-11-22T22:25:01Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  command = "configurationDone",
  request_seq = 6,
  seq = 12,
  success = true,
  type = "response"
}
[ DEBUG ] 2024-11-22T22:25:01Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  command = "launch",
  request_seq = 2,
  seq = 13,
  success = true,
  type = "response"
}
[ DEBUG ] 2024-11-22T22:25:01Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  body = {
    isLocalProcess = true,
    name = "/home/rpop/git/access-insights/access_insights/site_processor/blank_processor.py",
    pointerSize = 64,
    startMethod = "launch",
    systemProcessId = 49946
  },
  event = "process",
  seq = 14,
  type = "event"
}
[ DEBUG ] 2024-11-22T22:25:01Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  body = {
    reason = "started",
    threadId = 1
  },
  event = "thread",
  seq = 15,
  type = "event"
}
[ DEBUG ] 2024-11-22T22:25:02Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  body = {
    allThreadsStopped = true,
    description = "No module named 'access_insights'",
    preserveFocusHint = false,
    reason = "exception",
    text = "ModuleNotFoundError",
    threadId = 1
  },
  event = "stopped",
  seq = 16,
  type = "event"
}
[ DEBUG ] 2024-11-22T22:25:02Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1775 ]	"request"	{
  command = "threads",
  seq = 7,
  type = "request"
}
[ DEBUG ] 2024-11-22T22:25:03Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  body = {
    threads = { {
        id = 1,
        name = "MainThread"
      } }
  },
  command = "threads",
  request_seq = 7,
  seq = 17,
  success = true,
  type = "response"
}
[ DEBUG ] 2024-11-22T22:25:03Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1775 ]	"request"	{
  arguments = {
    startFrame = 0,
    threadId = 1
  },
  command = "stackTrace",
  seq = 8,
  type = "request"
}
[ DEBUG ] 2024-11-22T22:25:03Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  body = {
    stackFrames = { {
        column = 1,
        endColumn = 68,
        id = 2,
        line = 5,
        name = "<module>",
        source = {
          path = "/home/rpop/git/access-insights/access_insights/site_processor/blank_processor.py",
          sourceReference = 0
        }
      } },
    totalFrames = 1
  },
  command = "stackTrace",
  request_seq = 8,
  seq = 18,
  success = true,
  type = "response"
}
[ DEBUG ] 2024-11-22T22:25:03Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1775 ]	"request"	{
  arguments = {
    threadId = 1
  },
  command = "exceptionInfo",
  seq = 9,
  type = "request"
}
[ DEBUG ] 2024-11-22T22:25:03Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  body = {
    module = {
      id = 0,
      name = "__main__",
      path = "/home/rpop/git/access-insights/access_insights/site_processor/blank_processor.py"
    },
    reason = "new"
  },
  event = "module",
  seq = 19,
  type = "event"
}
[ DEBUG ] 2024-11-22T22:25:03Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  body = {
    module = {
      id = 1,
      name = "runpy",
      path = "/home/rpop/.pyenv/versions/3.11.7/lib/python3.11/runpy.py"
    },
    reason = "new"
  },
  event = "module",
  seq = 20,
  type = "event"
}
[ DEBUG ] 2024-11-22T22:25:03Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  body = {
    breakMode = "unhandled",
    description = "No module named 'access_insights'",
    details = {
      message = "No module named 'access_insights'",
      source = "/home/rpop/git/access-insights/access_insights/site_processor/blank_processor.py",
      stackTrace = "  File \"/home/rpop/git/access-insights/access_insights/site_processor/blank_processor.py\", line 5, in <module>\n    from access_insights.access_log_processor import AccessLogProcessor\nModuleNotFoundError: No module named 'access_insights'\n",
      typeName = "ModuleNotFoundError"
    },
    exceptionId = "ModuleNotFoundError"
  },
  command = "exceptionInfo",
  request_seq = 9,
  seq = 21,
  success = true,
  type = "response"
}
[ DEBUG ] 2024-11-22T22:25:03Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1775 ]	"request"	{
  arguments = {
    frameId = 2
  },
  command = "scopes",
  seq = 10,
  type = "request"
}
[ DEBUG ] 2024-11-22T22:25:03Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  body = {
    scopes = { {
        expensive = false,
        name = "Locals",
        presentationHint = "locals",
        source = vim.empty_dict(),
        variablesReference = 3
      }, {
        expensive = false,
        name = "Globals",
        source = vim.empty_dict(),
        variablesReference = 4
      } }
  },
  command = "scopes",
  request_seq = 10,
  seq = 22,
  success = true,
  type = "response"
}
[ DEBUG ] 2024-11-22T22:25:03Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1775 ]	"request"	{
  arguments = {
    variablesReference = 3
  },
  command = "variables",
  seq = 11,
  type = "request"
}
[ DEBUG ] 2024-11-22T22:25:03Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1775 ]	"request"	{
  arguments = {
    variablesReference = 4
  },
  command = "variables",
  seq = 12,
  type = "request"
}
[ DEBUG ] 2024-11-22T22:25:03Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1775 ]	"request"	{
  arguments = {
    variablesReference = 3
  },
  command = "variables",
  seq = 13,
  type = "request"
}
[ DEBUG ] 2024-11-22T22:25:03Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  body = {
    variables = { {
        evaluateName = "special variables",
        name = "special variables",
        type = "",
        value = "",
        variablesReference = 5
      }, {
        evaluateName = "class variables",
        name = "class variables",
        type = "",
        value = "",
        variablesReference = 6
      }, {
        evaluateName = "pd",
        name = "pd",
        type = "module",
        value = "<module 'pandas' from '/home/rpop/git/access-insights/.venv/lib/python3.11/site-packages/pandas/__init__.py'>",
        variablesReference = 7
      }, {
        evaluateName = "pendulum",
        name = "pendulum",
        type = "module",
        value = "<module 'pendulum' from '/home/rpop/git/access-insights/.venv/lib/python3.11/site-packages/pendulum/__init__.py'>",
        variablesReference = 8
      } }
  },
  command = "variables",
  request_seq = 11,
  seq = 23,
  success = true,
  type = "response"
}
[ DEBUG ] 2024-11-22T22:25:03Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  body = {
    variables = { {
        evaluateName = "special variables",
        name = "special variables",
        type = "",
        value = "",
        variablesReference = 9
      }, {
        evaluateName = "class variables",
        name = "class variables",
        type = "",
        value = "",
        variablesReference = 10
      }, {
        evaluateName = "pd",
        name = "pd",
        type = "module",
        value = "<module 'pandas' from '/home/rpop/git/access-insights/.venv/lib/python3.11/site-packages/pandas/__init__.py'>",
        variablesReference = 7
      }, {
        evaluateName = "pendulum",
        name = "pendulum",
        type = "module",
        value = "<module 'pendulum' from '/home/rpop/git/access-insights/.venv/lib/python3.11/site-packages/pendulum/__init__.py'>",
        variablesReference = 8
      } }
  },
  command = "variables",
  request_seq = 12,
  seq = 24,
  success = true,
  type = "response"
}
[ DEBUG ] 2024-11-22T22:25:03Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  body = {
    variables = { {
        evaluateName = "special variables",
        name = "special variables",
        type = "",
        value = "",
        variablesReference = 11
      }, {
        evaluateName = "class variables",
        name = "class variables",
        type = "",
        value = "",
        variablesReference = 12
      }, {
        evaluateName = "pd",
        name = "pd",
        type = "module",
        value = "<module 'pandas' from '/home/rpop/git/access-insights/.venv/lib/python3.11/site-packages/pandas/__init__.py'>",
        variablesReference = 7
      }, {
        evaluateName = "pendulum",
        name = "pendulum",
        type = "module",
        value = "<module 'pendulum' from '/home/rpop/git/access-insights/.venv/lib/python3.11/site-packages/pendulum/__init__.py'>",
        variablesReference = 8
      } }
  },
  command = "variables",
  request_seq = 13,
  seq = 25,
  success = true,
  type = "response"
}
[ DEBUG ] 2024-11-22T22:25:03Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1775 ]	"request"	{
  arguments = {
    variablesReference = 4
  },
  command = "variables",
  seq = 14,
  type = "request"
}
[ DEBUG ] 2024-11-22T22:25:03Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  body = {
    variables = { {
        evaluateName = "special variables",
        name = "special variables",
        type = "",
        value = "",
        variablesReference = 13
      }, {
        evaluateName = "class variables",
        name = "class variables",
        type = "",
        value = "",
        variablesReference = 14
      }, {
        evaluateName = "pd",
        name = "pd",
        type = "module",
        value = "<module 'pandas' from '/home/rpop/git/access-insights/.venv/lib/python3.11/site-packages/pandas/__init__.py'>",
        variablesReference = 7
      }, {
        evaluateName = "pendulum",
        name = "pendulum",
        type = "module",
        value = "<module 'pendulum' from '/home/rpop/git/access-insights/.venv/lib/python3.11/site-packages/pendulum/__init__.py'>",
        variablesReference = 8
      } }
  },
  command = "variables",
  request_seq = 14,
  seq = 26,
  success = true,
  type = "response"
}
[ DEBUG ] 2024-11-22T22:25:07Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1775 ]	"request"	{
  arguments = {
    granularity = "statement",
    threadId = 1
  },
  command = "next",
  seq = 15,
  type = "request"
}
[ DEBUG ] 2024-11-22T22:25:07Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  command = "next",
  request_seq = 15,
  seq = 27,
  success = true,
  type = "response"
}
[ DEBUG ] 2024-11-22T22:25:07Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  body = {
    allThreadsContinued = true,
    threadId = 1
  },
  event = "continued",
  seq = 28,
  type = "event"
}
[ DEBUG ] 2024-11-22T22:25:07Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  body = {
    reason = "exited",
    threadId = 1
  },
  event = "thread",
  seq = 29,
  type = "event"
}
[ DEBUG ] 2024-11-22T22:25:08Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  body = {
    exitCode = 1
  },
  event = "exited",
  seq = 30,
  type = "event"
}
[ DEBUG ] 2024-11-22T22:25:08Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  event = "terminated",
  seq = 31,
  type = "event"
}
[ DEBUG ] 2024-11-22T22:25:08Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  body = {
    sockets = { {
        host = "127.0.0.1",
        internal = false,
        port = 42375
      } }
  },
  event = "debugpySockets",
  seq = 32,
  type = "event"
}
[ WARN ] 2024-11-22T22:25:08Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1092 ]	"No event handler for "	{
  body = {
    sockets = { {
        host = "127.0.0.1",
        internal = false,
        port = 42375
      } }
  },
  event = "debugpySockets",
  seq = 32,
  type = "event"
}
[ DEBUG ] 2024-11-22T22:25:08Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  body = {
    sockets = {}
  },
  event = "debugpySockets",
  seq = 33,
  type = "event"
}
[ DEBUG ] 2024-11-22T22:25:08Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1042 ]	1	{
  body = {
    sockets = {}
  },
  event = "debugpySockets",
  seq = 34,
  type = "event"
}
[ WARN ] 2024-11-22T22:25:08Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1092 ]	"No event handler for "	{
  body = {
    sockets = {}
  },
  event = "debugpySockets",
  seq = 33,
  type = "event"
}
[ WARN ] 2024-11-22T22:25:08Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1092 ]	"No event handler for "	{
  body = {
    sockets = {}
  },
  event = "debugpySockets",
  seq = 34,
  type = "event"
}
[ ERROR ] 2024-11-22T22:25:09Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1542 ]	"stderr"	{
  args = { "-m", "debugpy.adapter" },
  command = "/home/rpop/.local/share/nvim/mason/packages/debugpy/venv/bin/python3",
  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=0x00007f67b796cef8)\n\nCurrent thread 0x00007f67b710fb80 (most recent call first):\n  <no Python frame>\n"
[ INFO ] 2024-11-22T22:25:09Z+0200 ] ...rpop/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1515 ]	"Process closed"	49932

@mfussenegger
Copy link
Owner

Doesn't reproduce for me with alacritty and based on the logs I also don't see anything fishy going on.

I initially thought it might be related to #1318 and #1340 but per log it doesn't send a env in the runInTerminal request.

Should be noted that this has worked in the past.

Could you run git bisect to find which commit broke it?

@thomas-haslwanter
Copy link

thomas-haslwanter commented Dec 13, 2024

I think I have the same problem. I have set things up with AstroNVim, run Win11, and similar to rpop0, starting the nvim-dap debugger starts and external console. [Addendum: playing around with Linux, I can confirm the comment on the AstroNVim documentation, that the problem is only a Windows problem, and does NOT come up on Linux!) The code

def some():
    print("Hello, world!")

if __name__ == "__main__":
    some()

is running fine in the debugger. But as soon as any external library is imported, I get an error. E.g.:

import numpy as np


def some():
    print("Hello, world!")


if __name__ == "__main__":
    some()
    print(np.arange(3))

gives me

nvim-dap: Thread stopped due to exception of type ModuleNotFoundError (unhandled)
Description: No module named 'numpy'
Stack trace:
File "C:\Users\thomas\CloudStation\Python\hello.py", line 1, in
import numpy as np
ModuleNotFoundError: No module named 'numpy'

The same problem occurs if I have any other import, e.g. matplotlib.pyplot.

@rpop0
Copy link
Author

rpop0 commented Dec 13, 2024

I'll so a bisect this weekend, I've been running the internal console so far

@thomas-haslwanter
Copy link

I was not able to find where I can set the option to an internal console. Could you please give me a hint, where you have done that? (PS: I am using AstroNvim, on Win11).

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

3 participants