We all have to debug our application very often in order to fix a bug, learn something new, or to understand the flow of our code, etc.
Have you ever tried to debug your code in Python and more specifically in VS Code?
If you have then you will find that the VS Code is not letting you get into the standard library packages. I wanted to know what is happening under the hood of those files so get a better understanding of why my code is not working as expected.
I was trying to
create_connection with the
socket library. Every time when my file ran I was getting this error.
Not quite helpful for me. I wanted to put my breakpoint to where it was throwing the error. Now the question was how to do this?
There are two steps for it:
- Add a configuration file if you don't have any.
It is very simple to do.
- Just go to the
- Click on the
After that just to select any one of the prompted options,
Python File was in my case but VS Code also supports frameworks like
Once this has been done you will see and
.vscode folder and in that folder, there will be a file named
Now the time comes to add those magical words which will make you able to debug the files other than you code.
launch.json, select the one configuration and add
justMyCode: false. THAT'S IT!
The VS Code will now allow you to roam around the code of the standard library and you can find the exact reason why your code is not working as expected.
In my case, the problem was that you don't prepend
https:// when you are passing
Follow me on Twitter