Skip to content

No‐Config Debugging

Eleanor Boyd edited this page Jan 27, 2025 · 6 revisions

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.

no-config-debug

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`.

Troubleshooting:

  • If you see the error python3: command not found you may not have a python3 available on the path environment variable which is required for no-config debugging since the debugpy command ultimately runs python3 in the background. Therefore, if you get this error you need to ensure that there is python3 on path, 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.
    Screenshot 2025-01-27 at 11 13 23 AM
    • 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.
    Screenshot 2025-01-27 at 11 13 43 AM
    • 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 command Developer: Set Log Level, and select trace. Next select the command Python: 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 have debugpy installed which conflicts with this new debugging experience. Uninstall debugpy from the selected environment by calling python -m pip uninstall debugpy. The VS Code debugging experience will still work as debugpy is bundled with the Python Debugger extension.

Screenshot 2025-01-27 at 11 31 08 AM
Clone this wiki locally