The extension supports debugging of a number of types of python applications.
However these are in active development.
The following debugging capabilities are supported:
Debugging a standard python application is possible by adding the standard configuration settings in the launch.json file as follows:
{
"name": "Python",
"type": "python",
"pythonPath":"${config.python.pythonPath}",
"request": "launch",
"stopOnEntry": true,
"console": "none",
"program": "${file}",
"cwd": "${workspaceRoot}",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
],
"env": {"name":"value"}
}
This setting points to the fully aualified path of the python program to be debugged.
The recommended value for this setting is ${file}
.
Resulting in the debugging of the active file in the editor.
Entering the name of the Python file is also supported. However you need to ensure the file name is fully qualitified path. You have two options:
{
"name": "Python",
"program": "/Users/xxx/Projects/PokemonGo-Bot/pokemongo_bot/event_handlers/__init__.py",
"cwd": "${workspaceRoot}",
/Users/xxx/Projects/PokemonGo-Bot
{
"name": "Python",
"program": "${workspaceRoot}/pokemongo_bot/event_handlers/__init__.py",
"cwd": "${workspaceRoot}",
This setting points to the python interpreter to be used for debugging purposes.
The default value of this setting is “${config.python.pythonPath}”, resulting in the use of the python interpreter configured in settings.json.
Initialize this setting with the arguments to be passed to the python program.
The setting "stopOnEntry":true
will cause the debugger to break at the first line of the python program being debugged.
If this is not desired, then change the value from true to false.
The default value of this setting is true.
This setting controls the display of a terminal (console window) for debugging. By default this is turned off (with a value of "none"
).
If a terminal (console window) is to be displayed whilst debugging, then use one of the following settings:
"console": "integratedTerminal"
: The integrated terminal will be used"console": "externalTerminal"
: An external terminal will be usedFor further details on debugging terminal (console) apps, go here.
This directory can be used to control (specify) the current directory of the python program being debugged. This defaults to the workspace root (project directory).
The setting “RedirectOutput”, will cause the debugger to print all output from the program into the VSCode debugger output window.
If this setting is missing, then all output from the program (such as those generated by Print commands) will not be displayed in the debugger output window.
If the setting externalConsole is enabled, then the suggestion would be to remove the setting “RedirectOutput” from this list.
This is because the output from the program will be displayed on the console window, and there’s no need for this information to be duplicated on the debugger output window.
The setting “env”, can be used to set custom environment variables for the debugger process.
If this setting is missing, then no additional environment variables are set. Whether this is set or not, the debugger process will inherit the environment variables.
The extension supports debugging of a number of types of python applications.
However these are in active development.
The following debugging capabilities are supported:
Debugging a standard python application is possible by adding the standard configuration settings in the launch.json file as follows:
{
"name": "Python",
"type": "python",
"pythonPath":"${config.python.pythonPath}",
"request": "launch",
"stopOnEntry": true,
"console": "none",
"program": "${file}",
"cwd": "${workspaceRoot}",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
],
"env": {"name":"value"}
}
This setting points to the fully aualified path of the python program to be debugged.
The recommended value for this setting is ${file}
.
Resulting in the debugging of the active file in the editor.
Entering the name of the Python file is also supported. However you need to ensure the file name is fully qualitified path. You have two options:
{
"name": "Python",
"program": "/Users/xxx/Projects/PokemonGo-Bot/pokemongo_bot/event_handlers/__init__.py",
"cwd": "${workspaceRoot}",
/Users/xxx/Projects/PokemonGo-Bot
{
"name": "Python",
"program": "${workspaceRoot}/pokemongo_bot/event_handlers/__init__.py",
"cwd": "${workspaceRoot}",
This setting points to the python interpreter to be used for debugging purposes.
The default value of this setting is “${config.python.pythonPath}”, resulting in the use of the python interpreter configured in settings.json.
Initialize this setting with the arguments to be passed to the python program.
The setting "stopOnEntry":true
will cause the debugger to break at the first line of the python program being debugged.
If this is not desired, then change the value from true to false.
The default value of this setting is true.
This setting controls the display of a terminal (console window) for debugging. By default this is turned off (with a value of "none"
).
If a terminal (console window) is to be displayed whilst debugging, then use one of the following settings:
"console": "integratedTerminal"
: The integrated terminal will be used"console": "externalTerminal"
: An external terminal will be usedFor further details on debugging terminal (console) apps, go here.
This directory can be used to control (specify) the current directory of the python program being debugged. This defaults to the workspace root (project directory).
The setting “RedirectOutput”, will cause the debugger to print all output from the program into the VSCode debugger output window.
If this setting is missing, then all output from the program (such as those generated by Print commands) will not be displayed in the debugger output window.
If the setting externalConsole is enabled, then the suggestion would be to remove the setting “RedirectOutput” from this list.
This is because the output from the program will be displayed on the console window, and there’s no need for this information to be duplicated on the debugger output window.
The setting “env”, can be used to set custom environment variables for the debugger process.
If this setting is missing, then no additional environment variables are set. Whether this is set or not, the debugger process will inherit the environment variables.