VSCode Run -> Start Debugging Python with Launch.json Doesn't Run Anything

Issue

In Visual Studio Code, After setting up a launch.json for Python Flask, I got a file like this:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
    {
        "name": "Python: Flask",
        "type": "python",
        "request": "launch",
        "module": "flask",
        "env": {
            "FLASK_APP": "app.py",
            "FLASK_DEBUG": "1"
        },
        "args": [
            "run",
            "--no-debugger",
            "--no-reload"
        ],
        "jinja": true,
        "justMyCode": true
    },
]

But when I try to run my project through the menu RunStart Debugging (F5), VSCode starts doing something and shows the debug bar (with pause/reload buttons), but a moment later the bar disappears without my projecting running at all, without even showing a terminal, printing logs, or giving any error message. How do I fix this?

Solution

This can happen when the Python version of your project (e.g. used by venv) is no longer supported by the Python debugger installed as a VSCode Extension. For example, Python 3.6 stopped being supported by the extension mid 2022, so if your project still uses Python 3.6, the latest version of the debugger will silently not work.

So there are two ways to fix: either you update Python to a supported version (recommended), or if that’s not possible then you can try downgrading the extension down to a version that still supports your outdated Python version.

To downgrade: click on Extensions (Ctrl+Shift+X), search for Python, click the options cog → Install another version..., and select an appropriate version (e.g. v2022.8.0 supports Python 3.6).

The options cog is at the bottom-right of the extension.

Answered By – OdraEncoded

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published