microsoft/ptvsd

Failure to spawn ptvsd.launcher is not propagated to the client

jhyunetp opened this issue · 6 comments

PS D:\repository> tre${env:PTVSD_LAUNCHER_PORT}='63554'; & 'C:\Users\USER\AppData\Local\Programs\Python\Python37\python.exe' 'c:\Users\USER\.vscode\extensions\ms-python.python-2020.2.63072\pythonFiles\lib\python\new_ptvsd\wheels\ptvsd\launcher' 'd:\repository\a.py' 
tre${env:PTVSD_LAUNCHER_PORT}=63554 : The term 'tre${env:PTVSD_LAUNCHER_PORT}=63554' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path   
is correct and try again.
At line:1 char:1
+ tre${env:PTVSD_LAUNCHER_PORT}='63554'; & 'C:\Users\USER\AppData\Local ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (tre${env:PTVSD_LAUNCHER_PORT}=63554:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 
Traceback (most recent call last):
  File "C:\Users\USER\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\USER\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "c:\Users\USER\.vscode\extensions\ms-python.python-2020.2.63072\pythonFiles\lib\python\new_ptvsd\wheels\ptvsd\launcher\__main__.py", line 80, in <module>
    main()
  File "c:\Users\USER\.vscode\extensions\ms-python.python-2020.2.63072\pythonFiles\lib\python\new_ptvsd\wheels\ptvsd\launcher\__main__.py", line 42, in main
    launcher.connect(launcher_port)
  File "c:\Users\USER\.vscode\extensions\ms-python.python-2020.2.63072\pythonFiles\lib\python\new_ptvsd\wheels\ptvsd\launcher/../..\ptvsd\launcher\__init__.py", line 27, in connect
    sock.connect(("127.0.0.1", launcher_port))
ConnectionRefusedError: [WinError 10061] 대상 컴퓨터에서 연결을 거부했으므로 연결하지 못했습니다
PS D:\repository>

This is my terminal log.

Error

“There is already a debug configuration ”Python: Current File“ running.”

This error keeps me from debugging.

I guess vscode python extension thinks my debugger is running though it is not because of some errors.

How can I let my debugger know it is not running?

Or Is there any way to launch several debuggers like pycharm?

The error message in the terminal is misleading. What actually happened is that you had "tre" typed at the command prompt in the terminal before debugging started. When it did start, it tried to use the same terminal to start your app, and command line got mangled as a result. The debugger is then complaining that it couldn't communicate with the app that it expects to be there.

Unfortunately, there's no API we can use to ensure that the terminal has a "clean" command prompt when launching the app, or even to detect that it was the cause of the failure.

This is also a problem that's broader than just the debugger - it applies to all tools that have to start something in the terminal. This is fundamentally the same problem as microsoft/vscode-python#8907.

I'm not entirely sure why VSCode thinks the debug session is still running here, but you should be able to stop it by using Debug -> Stop Debugging, or the same command on the floating debug toolbar.

Hello, int19h. Thank you for reply

I intentionally typed "tre" before command because it was a way to trigger this situation.

Your solution...

캡처

you should be able to stop it by using Debug -> Stop Debugging, or the same command on the floating debug toolbar.
-> after this kind of error occurs, there is no way but to restart my vscode. and as you can see, there is no stop debugging button.

It keeps stealing my time a lot.

Isn't it the issue I should submit to VSCode??

Hm, this is weird. And Debug -> Stop Debugging is disabled?

Yes, I have two dev computers.

They share this issue.

To trigger this situation,

  1. type anything in terminal
  2. Press F5 ( debug )
  3. ConnectionRefusedError: [WinError 10061] error pops up on terminal
  4. terminal is now cleared
  5. Press Shift + F5 ( debug ) again
  6. Now working * Just nothing happens
  7. Press F5 over and over
    =>
    There is already a debug configuration "Python: Current File" running.
    only this msg appears.

We don't propagate failures from "runInTerminal" request correctly.

It was the only reason I had to use Pycharm :)
Thank you for fixing this issue.