Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python debug mode not working properly #15969

Closed
isinyaaa opened this issue Apr 15, 2021 · 7 comments
Closed

Python debug mode not working properly #15969

isinyaaa opened this issue Apr 15, 2021 · 7 comments
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@isinyaaa
Copy link

Environment 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.languageServer setting: 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:

  1. I'm running a minimal file with no other extensions enabled
print('foo')

def bar():
    print('bar')

raise Exception('raising exception!')

bar()
  1. I'm also using an autogenerated launch.json for 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"
        }
    ]
}
  1. I set a breakpoint on the first line.

  2. Run file in debug mode.

image

Logs

Output for Python in the Output panel (ViewOutput, 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!

@isinyaaa isinyaaa added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Apr 15, 2021
@ghost
Copy link

ghost commented Apr 16, 2021

same here

@yumasheta
Copy link

yumasheta commented Apr 17, 2021

+1
Happens to me on 1.55.2 as well.

I also tested with latest insiders build:

Version: 1.56.0-insider
Commit: ce791d27dc9889a392f4d29abefe9c53eb0b5129
Date: 2021-04-16T11:25:09.908Z
Electron: 11.4.2
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Linux x64 5.11.14-arch1-1

with the extension version:
v2021.3.680753044

Could it be related to the recent changes to the Breakpoints:
https://code.visualstudio.com/updates/v1_55#_debugging

Edit:
It also appears to be the case for the older version as well. so not related to update.

But the problem popped up the same time as I upgraded to python 3.9.3-1
https://archlinux.org/packages/extra/x86_64/python/

To check this I ran the debugpy test suite for that python version:
72 failed, 360 passed, 3 skipped in 286.48 seconds

@FrozenAlex
Copy link

Having the same issue, couldn't debug my django application.

@yumasheta
Copy link

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?

@bulletmark
Copy link

@yumasheta thanks for the heads up. I downgraded python 3.9.3-1 -> 3.9.2-1 on my Arch system and now the Python debugger in visual-studio-code-bin AUR package is working again.

@isinyaaa
Copy link
Author

@yumasheta @bulletmark can confirm as well. I built the 3.9.4 from source and it works flawlessly.

@karthiknadig
Copy link
Member

karthiknadig commented Apr 19, 2021

Thanks for the response for the community. This is due to a issue with python itself (upgrading to 3.9.4 or downgrading to 3.9.2 should address this.)

@karthiknadig karthiknadig removed the triage-needed Needs assignment to the proper sub-team label Apr 19, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

5 participants