svaante / dape

Debug Adapter Protocol for Emacs
GNU General Public License v3.0
448 stars 25 forks source link

How do I set up a virtual environment that dape can use for python3? #102

Closed Odysseus6000 closed 1 month ago

Odysseus6000 commented 4 months ago

My dape is configured as follows: `(use-package dape :ensure t :config (setq dape-debug t) (add-to-list 'dape-configs '(debugpy modes (python-ts-mode python-mode)

             command "python3"
             command-args ("-Xfrozen_modules=off" "-m" "debugpy.adapter")
             :type "python"
            ;;  :request "attach"
             :request "launch"
             :module ""
            ;;  :cwd dape-cwd-fn
              ))

) The following error occurs when running debug in dape-repl: debug

svaante commented 4 months ago

I think the issue is that you are specifying :module as "" debugpy options. If you want to debug an module you need to specify the module name. If you want to debug an file use :program.

If you don't want to roll you own configurations you could change the ones which are included as:

(dolist (config-name '(debugpy debugpy-module))
  (let ((debugpy-config (alist-get config-name dape-configs)))
    (plist-put debugpy-config 'command
               "python3")
    (plist-put debugpy-config 'command-args
               '("-Xfrozen_modules=off" "-m" "debugpy.adapter" "--host" "0.0.0.0" "--port" :autoport))))

Not that pretty.

Why do you need to specify -Xfrozen_modules=off?

svaante commented 1 month ago

Closing due to inactivity, feel free to reopen the issue if the above does not fix your issue