Skip to content

Provide APIs to stop listening / stop debugger #870

@heartacker

Description

@heartacker

Before creating a new issue, please check the FAQ to see if your question is answered there.

Environment data

  • debugpy version: 1.5.1
  • OS and version: win 10 1067
  • Python version (& distribution if applicable, e.g. Anaconda): Python3.10.0 (tags/v3.10.0:b494f59, Oct 4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)]
  • Using VS Code or Visual Studio: VSCode

Actual behavior

connect success

Expected behavior

image

Steps to reproduce:

  1. vscode launch.json
        {
            "name": "Py:13579",
            "type": "python",
            "request": "attach",
            "port": 13578,
            "host": "localhost",
            "justMyCode": false,
        },
  1. python file
# import ptvsd
import debugpy
if sets.PY_DEBUG_MODE == 2:
    # ptvsd.enable_attach(('0.0.0.0', 13579))
    # print("debug with PTVSD")
    # ptvsd.wait_for_attach(15)
    # print('attach success')
    # ptvsd.break_into_debugger()

    # use debugpy
    debugpy.listen(("0.0.0.0", 13579))
    print("debug with debugpy")
    debugpy.wait_for_client(15)
    print('attach success')
    debugpy.breakpoint()
  1. run the python file and then attach
Message:	timed out waiting for adapter to connect
TypeName:	timed out waiting for adapter to connect
StackTrc:	  File "D:\Program Files\Python310\lib\site-packages\debugpy\server\api.py", line 232, in listen
    raise RuntimeError("timed out waiting for adapter to connect")
  File "D:\Program Files\Python310\lib\site-packages\debugpy\server\api.py", line 141, in debug
    return func(address, settrace_kwargs, **kwargs)
  File "D:\Program Files\Python310\lib\site-packages\debugpy\server\api.py", line 143, in debug
    log.reraise_exception("{0}() failed:", func.__name__, level="info")
  File "D:\Program Files\Python310\lib\site-packages\debugpy\__init__.py", line 113, in listen
    return api.listen(address)
  File "F:\A......\script\AC784x\pll_demo.py", line 23, in <module>
    debugpy.listen(("0.0.0.0", 13579))

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions