Home > Enterprise >  Visual Studio Code Opening in Browser
Visual Studio Code Opening in Browser

Time:04-24

I downloaded VSC and recently for a course I opened jupyter notebook in ubuntu. Now when I try running my programs in VSC it keeps opening the browser in chrome and says "This site can't be reached: local host failed to connect". I looked at some websites and they said to delete

    "action": "openExternally",
    "pattern": "^\\s*Now listening on:\\s (https?://\\S )"
},

from the launch:json file. But when I open the launch.json file it says

{
    // 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": "pwa-chrome",
            "request": "launch",
            "name": "Launch Chrome against localhost",
            "url": "http://localhost:8080",
            "webRoot": "${workspaceFolder}"
        }
    ]
}

Could someone please help me? Thank you for your time

CodePudding user response:

Just get rid of (or comment out) this entire section.

           "type": "pwa-chrome",
            "request": "launch",
            "name": "Launch Chrome against localhost",
            "url": "http://localhost:8080",
            "webRoot": "${workspaceFolder}"

This is instructions to open chrome, so if you remove it, chrome won't open on run.

Add the following settings to run python normally -

            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal"

For more details view the vs code page on launch.json config.

  • Related