0

I'm trying to use the Python debugger on VS Code 2019 on my Mac, but it looks like it is causing the program to hang indefinitely (the print statement never gets executed). If I run the program without the debugger, everything works. I don't have any breakpoints configured either.

Here is my code:

#!/usr/bin/env python3

dummy = input("Enter something: ")
print(dummy)

enter image description here

Edit: I'm not sure if it's related, but when I click the stop button "square", the program doesn't immediately quit. It takes a few seconds, and then I see this in my terminal window:

E+01487.808: Failed to kill Debuggee[PID=2791]

         Traceback (most recent call last):
           File "/Users/XXXXX/.vscode/extensions/ms-python.python-2020.8.101144/pythonFiles/lib/python/debugpy/launcher/../../debugpy/launcher/debuggee.py", line 160, in kill
             os.killpg(process.pid, signal.SIGKILL)
         PermissionError: [Errno 1] Operation not permitted
         
         Stack where logged:
           File "/Users/XXXXX/.vscode/extensions/ms-python.python-2020.8.101144/pythonFiles/lib/python/debugpy/launcher/../../debugpy/launcher/debuggee.py", line 162, in kill
             log.swallow_exception("Failed to kill {0}", describe())
           File "/Users/XXXXX/.vscode/extensions/ms-python.python-2020.8.101144/pythonFiles/lib/python/debugpy/launcher/../../debugpy/common/log.py", line 215, in swallow_exception
             _exception(format_string, *args, **kwargs)
         

(.venv) Scripts %

slantalpha
  • 515
  • 1
  • 6
  • 18
  • Try to close other running processes,and set a breakpoint for it to check the result. In addition, since the debugging function is provided by the python extension, try to close other extensions or install it again. – Jill Cheng Aug 14 '20 at 08:27
  • @JillCheng Thanks. I removed all VSCode extensions and deleted the application from my Applications folder and followed the instructions here https://stackoverflow.com/questions/42603103/how-to-completely-uninstall-vscode-on-mac (for a full uninstall). I was using a workspace, and I also closed out of the workspace and ran the debugger and selected "Python File Debug the currently active Python file", but still no luck unfortunately. I also tried and set a breakpoint at the print statement too. – slantalpha Aug 14 '20 at 23:14
  • Could you provide the content of your launch.json file?Have you tried using other versions of python extensions? There will also be folder access permissions issues, refer to: https://github.com/microsoft/vscode-python/issues/1125 Also check whether the 'pythonpath' is correct. – Jill Cheng Aug 17 '20 at 06:15
  • @JillCheng I'm using a virtualenv. My VS Code 2019 status bar is blue and shows that it's using the Python interpreter specified in my .venv directory. I'm using Python 3.7.6. – slantalpha Aug 17 '20 at 16:49
  • @JillCheng Here is my launch.json file: `{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "Python: Current File", "type": "python", "request": "launch", "program": "${file}", "console": "integratedTerminal" } ] }` – slantalpha Aug 17 '20 at 16:49
  • Also, the only Python extension I have installed is the Python extension from Microsoft (23,561,101 downloads). I also enabled debugging in the launch.json file and looked at the log files, but I don't see any errors while the program is waiting. I do see the same termination error in the log file when I try to stop the debugger, but no additional info as to why. – slantalpha Aug 17 '20 at 18:00
  • 2
    Thank you for providing us with this information. Currently, what I suggest is: If you are using the latest version of the python extension, please try to use the previous version. reference: https://stackoverflow.com/questions/63442844/vscode-cannot-read-user-input-while-debugging-a-python-code-in-integratedtermina?noredirect=1#comment112212796_63442844 and https://stackoverflow.com/questions/63421259/python3-not-accepting-my-keyboard-input-after-clicking-enter – Jill Cheng Aug 18 '20 at 03:07
  • Perfect! That fixed it. I also turned off auto-updating of extensions too. – slantalpha Aug 18 '20 at 18:16
  • I just encounter the same problem as well. Reverting to an older version works – Louis Go Jul 29 '21 at 01:19

0 Answers0