-
Notifications
You must be signed in to change notification settings - Fork 0
Debugging
#Debugging
The extension supports debugging of a number of types of python applications.
However these are in active development.
The following debugging capabilities are supported:
- Watch window
- Evaluating expressions
- Locals
- Arguments
- Expanding children
- Break points
- Conditional break points
- Pausing (breaking into) running programs
- Custom startup directory
- Debugging Django applications
- Debugging Google App Engine
- Terminal/Console Apps
- Remote Debugging
- Debugging nosetests
- Debugging pytest
###Debugging Options/Configuration 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"}
}####program
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.
####pythonPath
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.
####args Initialize this setting with the arguments to be passed to the python program.
####stopOnEntry
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.
####console
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 used
For further details on debugging terminal (console) apps, go here.
####cwd 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).
####debugOptions
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.
####env
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.