skip to Main Content

I have recently bought a new laptop and set up VSCode and Python so I can continue coding. Everything looks fine, took a bit of messing around to get virtual environments working, but apart from that no problem EXCEPT my code does not run.

To be specific, when I open my code and click "Run | Start Debugging (F5)", for an instant the little toolbar of debug buttons (run, step-over, etc) pops up and disappears, but the code in the window does not run, there is no output to the terminal, nothing happens!

A screenshot of my entire VSCode screen is below.
VSCode Window

My launch.json file is below.

    {
    // 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": [

        {
            "type": "chrome",
            "request": "launch",
            "name": "Launch Chrome against localhost",
            "file": "${workspaceFolder}/web/_test/book.html"
        },
    
        {
            "name": "Python: Current File",
            "type": "debugpy",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal"
        },

        {
            "name": "Python: Flask (development mode)",
            "type": "debugpy",
            "request": "launch",
            "module": "flask",
            "env": {
                "FLASK_APP": "flask_run.py",
                "FLASK_ENV": "development"
            },
            "args": [
                "run"
            ],
            "jinja": true
        }
    ]
}

I have all the python extensions installed.

enter image description here

2

Answers


  1. Click on python version in the lower right corner, then select switch to python 3.12.1 in the list.

    enter image description here

    enter image description here

    Login or Signup to reply.
  2. For me in some virtual environments with some scripts, adding "justMyCode": false to the config in my launch.json did actually help with this problem. Here is the documentation: https://code.visualstudio.com/docs/python/debugging#_justmycode

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search