Thursday 24 August 2023

[VS-Code] Activate python environment before starting debugging a file

While debugging a particular file on python, I came a scenario where I required to activate the python environment right after we start debugging.
By default, VS code starts PowerShell terminal.

Below is the modification required in launch.json file


       
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "env": {"PATH":"${workspaceFolder}/venv/Scripts/"},
            "console": "integratedTerminal",
            "justMyCode": true,
            "autoReload": {
                "enable": true
            }
        }




-Pankaj Dhapola
Let's Think on it