Skip to content

Connect from another python process rather than the VSCode debugger #1186

@Ennosch

Description

@Ennosch

Hi,

I was wondering if one could connect to the debugger, using either the debupy cli or another python script, rather than VSCode.

Using:

  • debugpy version: 1.6.5
  • OS and version: macOS 11.6
  • Python version Python 3.10.9
  • VS Code or shell

I am running
listen.py

import debugpy

debugpy.listen(("localhost", 5678))
debugpy.wait_for_client()
debugpy.breakpoint()

and try to connect via

import debugpy

debugpy.connect(('localhost', 5678))
debugpy.wait_for_attach()
debugpy.breakpoint()

Will get me this error

Traceback (most recent call last):
  File "/Users/user/Dev/rez_dev/py310/lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 252, in _on_run
    self.process_net_command_json(self.py_db, json_contents)
  File "/Users/user/Dev/rez_dev/py310/lib/python3.10/site-packages/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_process_net_command_json.py", line 172, in process_net_command_json
    assert request.type == 'request'
AssertionError

When trying to connect via

python -m debugpy --connect 5678 --pid 24017

I am getting another longer error.

Is this a trivial question ? Or would you expect this to be working without using any VSCode ?
It works fine when connecting via VSCode, as described in the docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions