question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot launch multiple Python debug sessions using VSC API

See original GitHub issue

Environment data

  • VS Code version: 1.37.1
  • Extension version (available under the Extensions sidebar): 2019.9.34474
  • OS and version: Win10
  • Python version (& distribution if applicable, e.g. Anaconda): 2.7
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): N/A
  • Relevant/affected Python packages and their versions: N/A
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info #3977): N/A

Expected behaviour

multiple Python debug sessions get launched upon executing the following code inside an extension:

for (let request of launchRequests) {
    request.executable = request.executable.toLowerCase();
    if (request.executable.endsWith("python") || request.executable.endsWith("python.exe")) {
        const pythonScript: string = request.arguments.shift();
        const pythonlaunchdebugconfiguration: vscode.DebugConfiguration = {
            name: `Python: launch`,
            type: "python",
            request: "launch",
            program: pythonScript,
            args: request.arguments,
            env: request.env,
            stopOnEntry: true,
        };
        vscode.debug.startDebugging(undefined, pythonlaunchdebugconfiguration);
    }
}

Actual behaviour

only 1 debug session gets launched, other debug sessions would hit a timeout error like this: image

Note

related to https://github.com/microsoft/vscode-python/issues/6017

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
DonJayamannecommented, Sep 11, 2019

I’d block this issue, waiting for the new Debug Adapter work. Else we’ll end up doubling our work looking at issues in both debug adapters.

1reaction
karthiknadigcommented, Feb 27, 2020

We need to test this. It should not be a problem anymore, since we use the same mechanism as above to attach to multiple processes. The only thing that is concerning is that this is using integratedTerminal which is default. I am not sure how that impact will be when launching multiple processes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Debugging configurations for Python apps in Visual Studio Code
If you're only interested in debugging a Python script, the simplest way is to select the down-arrow next to the run button on...
Read more >
visual studio code - run multiple python scripts at the same time
If there is no debug configuration yet, open the menu next to the run button and click on "add configuration ([your source folder])"....
Read more >
How to debug Python scripts in Visual Studio Code - SQLShack
Select Start Debugging from the Run menu · Selecting the Run icon from the left pane and click on Run and Debug ·...
Read more >
Debug Python code - Visual Studio (Windows) - Microsoft Learn
With a stand-alone Python file open, right-click in the editor, select Start with Debugging, and Visual Studio launches the script with the ...
Read more >
Debugging - vscode-docs
To debug your app in VS Code, you'll first need to set up your launch configuration file - launch.json . Click on the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found