Setting "justMyCode": false makes it stop at breakpoint:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Debug Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"stopOnEntry": true,
"justMyCode": false
},
]
}
Answer from Ashish on Stack OverflowHello, I tried to debug multiple python files in vscode v1.80 and they all had this common problem. It looks like I can't step line by line through functions and it just steps over the whole function and the breakpoint doesn't work inside the function. How can I debug inside the python function?
Setting "justMyCode": false makes it stop at breakpoint:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Debug Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"stopOnEntry": true,
"justMyCode": false
},
]
}
If you're using a pytest-cov module you might also wanna have a look at pytest configuration settings note:
Note If you have the
pytest-covcoverage module installed, VS Code doesn't stop at breakpoints while debugging becausepytest-covis using the same technique to access the source code being run. To prevent this behavior, include--no-covinpytestArgswhen debugging tests, for example by adding"env": {"PYTEST_ADDOPTS": "--no-cov"}to your debug configuration.
See an example configuration file (launch.json) below:
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Tests",
"type": "python",
"request": "test",
"console": "integratedTerminal",
"justMyCode": false,
"env": {"PYTEST_ADDOPTS": "--no-cov"}
}
]
}
Videos
I'm running the Visual Studio Community 2022 version. I'm attempting to use the debugger on a Python script, but there is an error notification next to my breakpoint which reads as follows:
The breakpoint will not currently be hit. Breakpoint in file excluded by filters
Note: may be excluded because of "justMyCode" option (default == true). Try setting "justMyCode": false in the debug configuration (e.g., launch.json)
I navigated to debug > options > general > just my code, and disabled the checkbox next to this. However, the same error message still occurs. Is there a launch.json file somewhere that needs to be edited as well?
EDIT
Here is some sample code that I have attempted to run using Visual Studio:
import os
def change_dirs(new_dir: str) -> str:
os.chdir(new_dir)
return 'Current working directory is ' + new_dir
change_dirs(input('Please enter a directory to change to:\n'))Here is a link to a screenshot that shows the above code, as well as the error message mentioned before.
And here is a link showing the "Just In Time" settings checkbox disabled. Even after disabling this setting and restarting the computer, the issue still persists.
EDIT 2:
Changed image links since imgur was not working
I do not know if this is the right flair. I am trying to debug code, but my breakpoints are being skipped. Despite them being set to an unconditional pause with the red circle. But it just keeps going past and skipping to the end of the program. I even deleted and reseted the json file.
The Python extension is broken - just seems to have updated at the same time as VS Code.
Go back to extension version v2021.12.1559732655 by clicking on the extensions control and selecting "Install another version...". Note that you will have to disable "Extensions: Auto Update", which might be a good thing. I also set "Update: Mode" to "none" for good measure.
So this bug is back with Python Extension version v2022.10.1 running on Ubuntu 18.04 with python 3.6.9.
This is a serious bug that keeps happening.
I had to roll back to extension version v2021.12.1559732655 to debug.
I'm running the Visual Studio Community 2022 version. I'm attempting to use the debugger on a Python script, but there is an error notification next to my breakpoint which reads as follows:
The breakpoint will not currently be hit. Breakpoint in file excluded by filters
Note: may be excluded because of "justMyCode" option (default == true). Try setting "justMyCode": false in the debug configuration (e.g., launch.json)
I navigated to debug > options > general > just my code, and disabled the checkbox next to this. However, the same error message still occurs. Is there a launch.json file somewhere that needs to be edited as well?
EDIT
Here is some sample code that I have attempted to run using Visual Studio:
import os
def change_dirs(new_dir: str) -> str:
os.chdir(new_dir)
return 'Current working directory is ' + new_dir
change_dirs(input('Please enter a directory to change to:\n'))Here is a link to a screenshot that shows the above code, as well as the error message mentioned before.
And here is a link showing the "Just In Time" settings checkbox disabled. Even after disabling this setting and restarting the computer, the issue still persists.
EDIT 2:
Changed image links since imgur was not working
When I set breakpoints in VSCode Jupyter cells, the breakpoints are ignored. How can I get them to stop code execution at the marked breakpoint?
Thank you!
This post was mass deleted and anonymized with Redact
lock relieved tie boast hat fearless heavy act fear point
Is it possible to put a conditional breakpoint in the Python debugger that breaks on raised exceptions only in a specific package, which I am developing? If so, how would I do this?
I'm new to using VS Code as I¡ve always used Eclipse IDE. I'm trying to debug my java file in which I've created a breakpoint, but the debugger just runs the code as if there wasn't such breakpoint..
I've seen some other people struggle with this, so here's my 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": "Java",
"type": "java",
"request": "launch",
"stopOnEntry": true,
"jdkPath": "${env:JAVA_HOME}/bin",
"cwd": "${fileDirname}",
"startupClass": "${fileBasenameNoExtension}",
"classpath": [
".",
"${fileDirname}"
]
},
{
"name": "Java Console App",
"type": "java",
"request": "launch",
"stopOnEntry": true,
"jdkPath": "${env:JAVA_HOME}/bin",
"cwd": "${fileDirname}",
"startupClass": "${fileBasenameNoExtension}",
"classpath": [
".",
"${fileDirname}"
],
"externalConsole": true
},
{
"type": "java",
"name": "Current File",
"request": "launch",
"mainClass": "${file}"
},
{
"type": "java",
"name": "Numeros",
"request": "launch",
"mainClass": "Numeros",
"projectName": "progra_4bad0bd0"
}
]
}Thanks in advance