Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

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

Closed
jhyunetp opened this issue Feb 13, 2020 · 6 comments · Fixed by microsoft/debugpy#50
Closed

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

jhyunetp opened this issue Feb 13, 2020 · 6 comments · Fixed by microsoft/debugpy#50
Assignees
Labels

Comments

@jhyunetp
Copy link

jhyunetp commented Feb 13, 2020

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?

@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python Feb 13, 2020
@int19h
Copy link
Contributor

int19h commented Feb 13, 2020

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.

@int19h int19h closed this as completed Feb 13, 2020
@jhyunetp
Copy link
Author

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??

@int19h int19h reopened this Feb 13, 2020
@int19h
Copy link
Contributor

int19h commented Feb 13, 2020

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

@jhyunetp
Copy link
Author

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.

@int19h int19h added the Bug label Feb 18, 2020
@int19h
Copy link
Contributor

int19h commented Feb 19, 2020

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

@int19h int19h self-assigned this Feb 19, 2020
@int19h int19h changed the title VS code python debugger doesn't work with “There is already a debug configuration ”Python: Current File“ running.” Failure to spawn ptvsd.launcher is not propagated to the client Feb 19, 2020
int19h added a commit to int19h/debugpy that referenced this issue Feb 19, 2020
Failure to spawn ptvsd.launcher is not propagated to the client

Propagate errors from listener sockets, Popen(), and "runInTerminal" request back to the client.
int19h added a commit to microsoft/debugpy that referenced this issue Feb 19, 2020
Failure to spawn ptvsd.launcher is not propagated to the client

Propagate errors from listener sockets, Popen(), and "runInTerminal" request back to the client.
@jhyunetp
Copy link
Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants