I've been trying to get dap working with python in Spacemacs for a week. I'm trying to start using Spacemacs as my main Python IDE, I should mention I'm new to emacs and spacemacs, I could be missing a step that you think is obvious.
In my .spacemacs file, under dotspacemacs-configuration-layer, I've included auto-completion, lsp, python, and dap (all without any special configurations, I'm just using the defaults). Everything works except for dap so far, for example I can execute my code, and auto-completion works great.
But, when I try to debug a python file (by running SPC d d d
, then selecting Python :: Run file (buffer)
) I get some complex error message, here is the full output:
-*- mode: dap-server-log; default-directory: "~/Desktop/scratch/" -*-
Debug Adapter started at Sun Jun 12 09:51:56
/usr/bin/python -m ptvsd --wait --host localhost --port 34639 trash.py
Traceback (most recent call last):
File "/home/otooleat/.local/lib/python3.10/site-packages/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 283, in _on_run
self.process_net_command_json(self.global_debugger_holder.global_dbg, json_contents)
File "/home/otooleat/.local/lib/python3.10/site-packages/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_process_net_command_json.py", line 164, in process_net_command_json
cmd = on_request(py_db, request)
File "/home/otooleat/.local/lib/python3.10/site-packages/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_process_net_command_json.py", line 623, in on_stacktrace_request
self.api.request_stack(py_db, request.seq, thread_id, fmt=fmt, start_frame=start_frame, levels=levels)
File "/home/otooleat/.local/lib/python3.10/site-packages/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_api.py", line 190, in request_stack
if internal_get_thread_stack.can_be_executed_by(get_current_thread_id(threading.current_thread())):
File "/home/otooleat/.local/lib/python3.10/site-packages/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 595, in can_be_executed_by
self._cmd = py_db.cmd_factory.make_get_thread_stack_message(
File "/home/otooleat/.local/lib/python3.10/site-packages/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_net_command_factory_json.py", line 238, in make_get_thread_stack_message
end = min(start + levels, total_frames)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
[1]
Debug Adapter finished at Sun Jun 12 09:51:57
... I have no idea how to interpret that. I've been reading everything I can read, but the different levels of integration (dap + emacs + spacemacs) is making it difficult to learn about the problem.
I've installed ptvsd using pip install "ptvsd>=4.2"
, my understanding is that as long as that is installed, and I include dap and lsp in my .spacemacs file, it should just work. Am I missing something dumb? I have a feeling I haven't installed a required package or I'm not starting the debugger correctly. For example am I suppose to edit that Python :: Run file (buffer)
debug configuration template or something? Or should that work out of the box? I'm also assuming that pressing SPC d d d
while my active buffer is a python file is enough for the system to realize that I want it to debug that python file, is that correct?
Any help would be appreciated, I'm really loving Spacemacs so far and would love to be able to use it as my main IDE.