-
Notifications
You must be signed in to change notification settings - Fork 30
No‐Config Debugging
No config debugging allows you to leverage debugging features without the need for configurations in a launch.json
. To use, open a terminal and type debugpy <script.py or module>
. This command will invoke a debug session, and any breakpoints set in your script or module will hit.
Note: The launched debug session is attached to the script or module run in the terminal, therefore cancelling the debug session will not exit the terminal script / module.
Note: Due to conflicts in path variable, it is not possible to use no-config debugging while having the experiment
pythonTerminalEnvVarActivation
on. To opt out of the experiment, add"python.experiments.optOutFrom": ["pythonTerminalEnvVarActivation"]
to your User ‘settings.json`.
-
If you see the
error python3: command not found
you may not have apython3
available on thepath
environment variable which is required for no-config debugging since thedebugpy
command ultimately runspython3
in the background. Therefore, if you get this error you need to ensure that there ispython3
onpath
, which may require checking that the correct environment you want to use is selected or the desired virtual environment is activated in the given terminal before calling no-config debugging. -
If you see the error
command not found: debugpy
there are a few options:- Check to see if your terminal has the yellow warning label to signify the terminal is out of date, if so, reload or launch a new terminal instance.
- Hover over the terminal instance to check that the Python Debugger extension has contributed to the terminal’s environment. If you don’t see it here, make sure your extensions are up to date and reload or try the tip below.
- As noted, it is not possible to use no-config debugging while having the experiment
pythonTerminalEnvVarActivation
on. You can check to confirm you have successfully disabled the experiment with the following steps. Go to the Command Palette, run the commandDeveloper: Set Log Level
, and select trace. Next select the commandPython: Show Output
and confirm you see “Experiment 'pythonTerminalEnvVarActivation' is inactive` in the logs. If not, check your settings and make sure this experiment is turned off.
-
If you see a string of output including
Error: either --listen or --connect is required
in your logs, you might already havedebugpy
installed which conflicts with this new debugging experience. Uninstalldebugpy
from the selected environment by callingpython -m pip uninstall debugpy
. The VS Code debugging experience will still work asdebugpy
is bundled with the Python Debugger extension.