0

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.

0

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.

| improve this answer | |
  • I created executable in my $PATH as a osascript since it doesn't look like iterm is a default executable in osx. It opens a new terminal, but now I need to find a way for it to execute the debugger there. osascript <<EOD tell application "iTerm" create window with default profile end tell EOD – LLL Jan 14 at 6:29
  • 1
    You just have to start the process that you have received as an argument: e. g. it will be called like that osascript python -m ptvsd ... – Ivan Dimitrov Yonchovski Jan 14 at 10:02

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.