1

I am trying to make dap-mode for python working on spacemacs.

For the most part I was able to get it working, but I am having issues taking in input on the CLI

def main():
  a = input(">")

The debug pane

-*- mode: dap-server-log; default-directory: "~/test2/" -*-
Debug Adapter started at Sun Jan 12 15:32:25

/Users/user/.pyenv/versions/3.7.0/bin/python -m ptvsd --wait --host localhost --port 32000  /Users/user/test2/main.py 
>

Problem: can't type user input in the debug pane


I found a potential solution here, but couldn't quite get it working.

https://github.com/emacs-lsp/dap-mode/issues/169 https://github.com/emacs-lsp/dap-mode/issues/97

I tried using the configurations below on osx but get an error:

(setq dap-python-terminal "iterm ") but I get zsh:1: command not found: iterm and

(setq dap-python-executable "iterm") but I get wrong type argument: arrayp, nil

also tried (setq dap-python-terminal "open -a Terminal ")

Env osx, iterm, spacemacs/emacs, zsh, python

Note: I know how to use pdb, but really like the dap-ui on spacemacs so I'd prefer to use that layer if I can get this one small issue sorted out.


Edit: It has something to do with the executable of iterm on my machine

Since iterm doesn't have a default executable on osx, after some searching it looks like I had to write an osascript. I wrote one and put it on my path

osascript <<EOD
  tell application "iTerm"
    create window with default profile
  end tell
EOD
-*- mode: dap-server-log; default-directory: "~/test2/" -*-
Debug Adapter started at Mon Jan 13 22:39:29

iterm /Users/user/.pyenv/versions/3.7.0/bin/python -m ptvsd --wait --host localhost --port 32000  /Users/user/test2/main.py 
window id 11705

Debug Adapter finished at Mon Jan 13 22:39:29

It starts up a new window, but doesn't go into debugging mode.

1
  • My guess is that iterm is not on the path. Can you execute (executable-find "iterm")? You may edit spacemacs environment via SPC f e e. Jan 14 '20 at 0:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.