Python debug mode not working properly
See original GitHub issueEnvironment data
- VS Code version: 1.55.2-1
- Extension version (available under the Extensions sidebar): v2021.3.680753044
- OS and version: 5.11.14-arch1-1
- Python version: 3.9.3-1
- Type of virtual environment used: N/A
- Relevant/affected Python packages and their versions: debugpy (1.2.1)
- Relevant/affected Python-related VS Code extensions and their versions: ms-python.python
- Value of the
python.languageServersetting: Pylance
Expected behaviour
If there are breakpoints or exceptions, when run in debug mode, application should be stopped and taken to breakpoints.
Actual behaviour
When run in debug mode the application doesn’t stop where it should.
Steps to reproduce:
- I’m running a minimal file with no other extensions enabled
print('foo')
def bar():
print('bar')
raise Exception('raising exception!')
bar()
- I’m also using an autogenerated
launch.jsonfor the sake of simplicity
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}
-
I set a breakpoint on the first line.
-
Run file in debug mode.

Logs
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
foo
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/isinyaaa/.vscode/extensions/ms-python.python-2021.3.680753044/pythonFiles/lib/python/debugpy/__main__.py", line 45, in <module>
cli.main()
File "/home/isinyaaa/.vscode/extensions/ms-python.python-2021.3.680753044/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 444, in main
run()
File "/home/isinyaaa/.vscode/extensions/ms-python.python-2021.3.680753044/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 285, in run_file
runpy.run_path(target_as_str, run_name=compat.force_str("__main__"))
File "/usr/lib/python3.9/runpy.py", line 268, in run_path
return _run_module_code(code, init_globals, run_name,
File "/usr/lib/python3.9/runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/isinyaaa/projects/test/test.py", line 6, in <module>
raise Exception('raising exception!')
Exception: raising exception!
Issue Analytics
- State:
- Created 2 years ago
- Reactions:8
- Comments:7 (1 by maintainers)
Top Results From Across the Web
VS Code Debugger not working for python - Microsoft Q&A
Debugging was working fine. Any troubleshooting tips. It seems when I do Run->"start Debugging' no command comes to terminal.
Read more >Python debugger not working while normal run does
The python debugger in Pycharm (I've the latest version) is not working for any Python file (so it's not my project or anything)....
Read more >Python debugging not working #18473 - GitHub
Debugger is not starting. It is just showed and disappear immediately. No error no message. At the same run button work as expected....
Read more >Debugging Python program doesn't work after updating to VS ...
Click on the python extention (publisher microsoft) and select "install pre-release ". It would be V2022.5.10961002 (you can see it when you ...
Read more >Debugging configurations for Python apps in Visual Studio Code
If you're only interested in debugging a Python script, the simplest way is to select the down-arrow next to the run button on...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I just realized that Python version 3.9.3 had a major bug: https://www.python.org/downloads/release/python-393/
So I built 3.9.4 from source and tested debugging. It now works. So it looks like the issue will be resolved as soon as 3.9.4 hits repositories…
can anyone else reproduce?
same here