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

Running M-x dape gives file-local-name: Wrong type argument: stringp, nil #182

Open
ZelphirKaltstahl opened this issue Dec 15, 2024 · 4 comments

Comments

@ZelphirKaltstahl
Copy link

ZelphirKaltstahl commented Dec 15, 2024

Either I don't get how to actually start a debugging session, or something is wrong. Whenever I run M-x dape in a Python file (that has a breakbpoint) it asks me:

Run adapter: debugpy comment "/home/user/dev/python/triplets/venv/bin/python"

I confirm that.
Then I get an error:

file-local-name: Wrong type argument: stringp, nil

Emacs is:

GNU Emacs 29.4 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, cairo version 1.18.0)

My init.el config is:

(use-package dape
  :hook
  ;; Save breakpoints on quit
  (kill-emacs . dape-breakpoint-save)
  ;; Load breakpoints on startup
  (after-init . dape-breakpoint-load)
  ;; Info buffers to the right
  (setq dape-buffer-window-arrangement 'right)
  )

;; Enable repeat mode for more ergonomic `dape' use
(use-package repeat
  :config
  (repeat-mode))

My dape.el version is: 0.16.0.

My Python venv has:

Package               Version
--------------------- -------
debugpy               1.8.11
docstring-to-markdown 0.15
jedi                  0.19.2
parso                 0.8.4
pip                   22.0.2
pluggy                1.5.0
python-lsp-jsonrpc    1.1.2
python-lsp-server     1.12.0
setuptools            59.6.0
ujson                 5.10.0

So I got debugpy and a language server (https://github.com/python-lsp/python-lsp-server).

file-local-name: Wrong type argument: stringp, nil

So file-local-name is not a string? Do I interpret the error correctly? And what presumes it to be existing and why is it not a string? I am not sure what causes the issue.

@svaante
Copy link
Owner

svaante commented Dec 15, 2024

Hey!
I am note sure if it's a typo in the issue but if you are specifying another python then the one under path it should be command not comment in.

Run adapter: debugpy comment "/home/user/dev/python/triplets/venv/bin/python"

If that is a typo I would need the backtrace.

M-x toggle-debug-on-error then share the contents of *Backtrace*.

@ZelphirKaltstahl
Copy link
Author

If that is a typo I would need the backtrace.

Ah, sorry for that, it is indeed a typo. The actual text there is:

Run adapter: debugpy command "/home/user/dev/python/triplets/venv/bin/python"

And here is the backtrace:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  file-remote-p(nil localname)
  file-local-name(nil)
  tramp-file-local-name(nil)
  dape-cwd()
  funcall-interactively(dape-cwd)
  dape--config-eval-value(dape-cwd nil t nil)
  dape--config-eval-1((modes (python-mode python-ts-mode) ensure (lambda (config) (dape-ensure-command config) (let ((python (dape-config-get config 'command))) (unless (zerop (call-process-shell-command (format "%s -c \"import debugpy.adapter\"" python))) (user-error "%s module debugpy is not installed" python)))) command "/home/user/dev/python/triplets/venv/bin/python" command-args ("-m" "debugpy.adapter" "--host" "0.0.0.0" "--port" :autoport) port :autoport :request "launch" :type "python" :cwd dape-cwd :program dape-buffer-default :args [] :justMyCode nil :console "integratedTerminal" :showReturnValue t :stopOnEntry nil))
  dape--config-eval(debugpy (modes (python-mode python-ts-mode) ensure (lambda (config) (dape-ensure-command config) (let ((python (dape-config-get config 'command))) (unless (zerop (call-process-shell-command (format "%s -c \"import debugpy.adapter\"" python))) (user-error "%s module debugpy is not installed" python)))) command "/home/user/dev/python/triplets/venv/bin/python" command-args ("-m" "debugpy.adapter" "--host" "0.0.0.0" "--port" :autoport) port :autoport :request "launch" :type "python" :cwd dape-cwd :program dape-buffer-default :args [] :justMyCode nil :console "integratedTerminal" :showReturnValue t :stopOnEntry nil))
  dape--read-config()
  byte-code("\300 C\207" [dape--read-config] 1)
  command-execute(dape record)
  execute-extended-command(nil "dape" nil)
  funcall-interactively(execute-extended-command nil "dape" nil)
  command-execute(execute-extended-command)

@svaante
Copy link
Owner

svaante commented Dec 16, 2024

Strange it looks like dape-cwd-fn is returning nil.

I don't think it will fix your issue but you seam to have an older
version of dape then what is available on elpa.

What happens if you specify :cwd

Run adapter: debugpy command "/home/user/dev/python/triplets/venv/bin/python" :cwd "/abs/path/to/current-directory/"

@ZelphirKaltstahl
Copy link
Author

Yes! That did it! If I specify the :cwd it works! No error and I get to see all those buffers and it stops at the breakpoint.

Thank you!

Do you think this issue should be closed, or left open to investigate the dape-cwd-fn thing?

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

2 participants