Skip to content

debugpy.configure(python=) is not properly documented #1097

Open
@LostTime76

Description

@LostTime76

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

Environment data

  • debugpy version: XXX (run import debugpy; print(debugpy.__version__) if uncertain)
  • OS and version: XXX
  • Python version (& distribution if applicable, e.g. Anaconda): XXX
  • Using VS Code or Visual Studio:

Actual behavior

The parent program seemingly recursively gets created and started as a process without any easy way to kill the large number of processes created.

Expected behavior

It attached and works...

Steps to reproduce:

  1. Embed python into a program using the C API.
  2. Make a top level script that includes debugpy debugging... import debugpy, debugpy.listen, debugpy.wait_for_client, etc..
  3. Have parent program run and execute the top level script.

Not sure if this is a bug or is explained elsewhere. I am not going to spend the time to get involved and go through the forum. I am only leaving this here as a "gotcha" for a lonely passerby who ends up in the same scenario. Please edit / move as necessary.

In my use case, I want debugpy debugger support in a hosted (embedded) python environment. The user calls the user program and not python.exe. As such, sys.executable gets set to the exe of the program and not the expected python.exe. Why does this cause an infinite process recursion or fail to connect to the client debugger?

image

That would be why.

Moral of the story is.. make sure your sys.executable is set to python.exe in the hosted environment before using debugpy with the listening setup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions