Goutham Ganesan
Goutham Ganesan

Reputation: 959

External Terminal Debugger in VS Code

As I can't give input in the debug console, I'm trying to run the debugger in External terminal in VS Code.

This is the part of launch.json config file for external terminal.

{
            "name": "Python: Terminal (external)",
            "type": "python",
            "request": "launch",
            "stopOnEntry": true,
            "pythonPath": "${config:python.pythonPath}",
            "program": "${file}",
            "cwd": "",
            "console": "externalTerminal",
            "env": {},
            "externalConsole": true,
            "envFile": "${workspaceRoot}/.env",
            "debugOptions": [
                "WaitOnAbnormalExit",
                "WaitOnNormalExit"
            ]
},

I added the "externalConsole": true part as they said here and I tried with or without that statement.

I get this error,

Debug adapter process has terminated unexpectedly

I tried the docs and the IntelliSense in the json file, but I can't understand and get it to work.

Upvotes: 3

Views: 16785

Answers (3)

techiexplorer
techiexplorer

Reputation: 77

Adding "console": "externalTerminal", to the debug configuration file worked fine on Linux!

Upvotes: 5

Hojjat Bakhtiyari
Hojjat Bakhtiyari

Reputation: 187

Also remember to put correct value for external terminal location in :

terminal.external.windowsExec

Upvotes: -2

Zac
Zac

Reputation: 21

I am using windows, however, this should fix your problem.

"name": "Python: Terminal (external)",
        "type": "python",
        "request": "launch",
        "stopOnEntry": true,
        "pythonPath": "C:/Users/Zac/Anaconda3/python.exe",
        "program": "${file}",
        "cwd": "",
        "console": "externalTerminal",
        "env": {},
        "envFile": "${workspaceFolder}/.env",
        "debugOptions": [
            "RedirectOutput"
        ]
    },

You need to correctly add a path to your python.exe location in the "pythonPath" line.

Also, take out the "WaitOnAbnormalExit" and "WaitOnNormalExit" from "debugOptions" and just use "RedirectOutput". Remove "externalConsole": true from the code.

Everything else should stay the same.

Hope that helps. Cheers.

Upvotes: 2

Related Questions