-
Notifications
You must be signed in to change notification settings - Fork 137
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
Just my code not working in VS code #1674
Comments
setting "debugpy.debugJustMyCode": false is the cause of the issue. Basically:
|
Configuration used:
|
Thanks for your bug report @irm-codebase, that was a bug in vscode related to justMyCode, can you try again and see if the error persist with the last version of vscode? Thanks |
@paulacamargo25 thanks for the help! Tried with the config below. VSCode is telling me that those settings are not being checked: Is this another, separate issue? launch.json config: {
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Current File",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": false
}
]
} settings.json:
|
Also, small little rant: VSCode has been... pretty bad to work with lately. Obviously not the fault of the folks helping with this issue, but it's just... kind of a bad IDE to work with at the moment. At least for python... |
Hey @karthiknadig, this issue might need further attention. @irm-codebase, you can help us out by closing this issue if the problem no longer exists, or adding more information. |
@karthiknadig since the bot asked... this bug is till present in the newest VSCode version. |
The |
This works for me. I used this code here: import pytest
def test_justmycode():
pytest.skip("test_justmycode is not implemented yet.")
test_justmycode() Then I stuck a breakpoint in this file: .venv\Lib\site-packages_pytest\outcomes.py The breakpoint hit when running with justMyCode=false. Can you try that same repro? It might be a path mapping problem. The file you have with the 3rd party code is not the path that debugger is finding. |
@rchiodo just to be clear on this: was your question directed at me? or at other maintainers tackling this issue? |
I repeated your test case with the following in my
import pytest
def test_justmycode():
pytest.skip("test_justmycode is not implemented yet.")
test_justmycode()
{
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"debugpy.debugJustMyCode": false
}
|
Okay it looks like it actually worked it's just the callstack isn't showing up. What's your version of VS code? There was a bug in VS code where they were hiding 'internal' stack frames (which these frames would be marked as). This issue here: I'd try updating to the latest VS code and see if the problem reproduces. It seems to work for me on 1.94.0-insiders and 1.93.1 stable This is the callstack I get: |
@rchiodo apologies for the delay |
I still suspect a VS code issue. We can double check that we're sending the stack frames but this is the same symptoms as the bug I mentioned above. If you turn this on: "logToFile": true In your launch.json. That will generate logs in your |
It might be, but I am not a VScode nor a debugpy dev... so interpreting this is a tad difficult for me. I think I generated the log file successfully. Here is what it has at the bottom (just as a way to see if I'm in the right file): 1416 Client --> Adapter:
{
"command": "stackTrace",
"arguments": {
"threadId": 1,
"startFrame": 4,
"levels": 19
},
"type": "request",
"seq": 15
}
1420 Client <-- Adapter:
{
"seq": 27,
"type": "response",
"request_seq": 15,
"success": true,
"command": "stackTrace",
"body": {
"stackFrames": [],
"totalFrames": 4
}
} |
The log makes it look like debugpy isn't returning the stack frames. Can you upload all of the other log files from that run? The pydevd one might give us a clue as to why there's no stack frames listed there. |
Here it is! |
Hmm, doesn't make sense. It has a stack, but it doesn't return it. It returns it once but not the second time. Not sure why there's two threads shown either. I think we'd need the code to reproduce the problem. Can you share the code that's causing this? |
It's the same code as the one you shared above. Here are some settings, and a project (https://github.com/calliope-project/ec_utils/tree/feature-modulegraph), although honestly I do not think the project will matter. Script: import pytest
def test_justmycode():
pytest.skip("test_justmycode is not implemented yet.")
test_justmycode() launch.json {
// 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 Debugger: Current File",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"logToFile": true
}
]
} vscode settings (general) {
"workbench.colorTheme": "Catppuccin Mocha",
"redhat.telemetry.enabled": false,
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
},
"git.autofetch": true,
"cSpell.language": "en,en-GB",
"cSpell.diagnosticLevel": "Hint",
"jupyter.runStartupCommands": [
"%load_ext autoreload",
"%autoreload 2"
],
"editor.fontFamily": "\"Fira Code\"",
"editor.fontWeight": "normal",
"editor.fontLigatures": true,
"workbench.iconTheme": "catppuccin-mocha",
"terminal.integrated.inheritEnv": false,
"update.mode": "manual",
"jupyter.askForKernelRestart": false,
"jupyter.notebookFileRoot": "${workspaceFolder}",
"jupyter.interactiveWindow.creationMode": "perFile",
"window.restoreWindows": "none",
"telemetry.telemetryLevel": "off",
"ruff.nativeServer": true,
"ruff.lint.ignore": [
"PD004",
"PD003"
],
"mypy.debugLogging": true,
"mypy.dmypyExecutable": "/home/ivanruizmanuel/miniforge3/bin/dmypy",
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/*/**": true,
"**/.hg/store/**": true,
"**/.snakemake/**": true
},
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true,
"**/.snakemake": true
},
"markdownlint.config": {
"MD007": {
"indent": 4
}
},
"ruff.configurationPreference": "filesystemFirst",
"hediet.vscode-drawio.theme": "Kennedy"
} vscode settings (project): {
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"debugpy.debugJustMyCode": false
}
|
You must have 'raised exceptions' checked: It's hitting those before it gets to the breakpoint. If you turn off that setting it should work. VS code doesn't show non user code in those raised exceptions. You have to expand them: I get this (if I enable raised exceptions): If you want to see these frame you have to click on the 'show 3 more frames', but none of your code is in it. This is what it will show if you click on the 'show 3 more frames' |
It is as easy as that, huh? The problem is gone. Just for my understanding: basically, this is a bunch of 'harmless' internal Python exceptions that are hit before our test code runs, correct? Honestly I was assuming that this was a bug caused by debugpy or VSCode forgetting the active environment or something. Thanks again! |
Yes, that's correct. Lots of other spots in the runtime or pytest can throw and handle exceptions before or even during your test running. |
Redirected from #224487
Type: Bug
As the title says: when I set a launch.json file and try to debug my code (selecting "with launch.json", VScode returns:
[Errno 2] No such file or directory: 'home/[myusername]/.local/lib
This is making debugging code outside mine (justMyCode=false) impossible, and is very annoying. What's going on?
Note: I use conda, and I have correctly selected my interpreter to be conda.
VS Code version: Code 1.91.1 (f1e16e1e6214d7c44d078b1f0607b2388f29d729, 2024-07-09T22:08:12.169Z)
OS version: Linux x64 6.9.11-200.fc40.x86_64
Modes:
System Info
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Extensions (32)
The text was updated successfully, but these errors were encountered: