dape icon indicating copy to clipboard operation
dape copied to clipboard

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

Open Odysseus6000 opened this issue 10 months ago • 1 comments

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

  • Adapter started with "python3 -Xfrozen_modules=off -m debugpy.adapter" * Process launched ~/.virtualenvs/pro/bin/python3: No module named
  • Exit code: 1 *
  • Session terminated * ` mac,[email protected], dape-0.10.0.0.20240404.182237

Odysseus6000 avatar Apr 12 '24 00:04 Odysseus6000

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 avatar Apr 16 '24 17:04 svaante

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

svaante avatar Jul 14 '24 08:07 svaante