1

Asking this again as this wasn't really answered:

In python, VSCode debugger won't step into external code. Can't figure out how to edit "justMyCode" in launch.json

I'm just trying to debug some python in visual studio code.

Also I don't really know what I'm doing because I'm a java guy and not a python guy.

First, I tried using the python debugger, and put in some breakpoints. But then when I ran the program, it wouldn't stop at the breakpoints.

So then, I was googling and read that I need to change a setting in my launch.json configuration:

        {
            "name": "Python: Debug Current File",
            "type": "python",
            "request": "test",
            "program": "${file}",
            "console": "integratedTerminal",
            "stopOnEntry": true,
            "justMyCode": false
        }

As you can see, I added a new configuarion with justMyCode set to false, and request set to test. It underlines both in green, saying Property is not allowed for justMyCode and Value is not accepted for request as test. I tried changing request to launch, but still the justMyCode error is coming.

What am I doing wrong?? Why is it so difficult to debug python in vs code when it is so much simpler in eclipse with java??

(python 3.7.1 extension installed (with debugging))

cluis92
  • 664
  • 12
  • 35

2 Answers2

2

Add "purpose": ["debug-in-terminal"] to launch.json. More details here.

  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/30544699) – AfterFray Dec 10 '21 at 04:37
1

I want to get more information from you.

Here is the Python debug configuration I have taken, and it works well as it can let me debug the standard library. I just use the default Python extension debug configuration and adds '"justMyCode": false':

    {
      "name": "Python: Current File",
      "type": "python",
      "request": "launch",
      "program": "${file}",
      "console": "integratedTerminal",
      "justMyCode": false
    }

In a python file, I add this code:

import pandas as pd

and add a breakpoint on this line. When the debugger stop at this line, Click 'Step Into(F11)' to get into '__init__.py' file in the pandas package. And when I set '"justMyCode": true' configuration in launch.json file, I can't get into pandas package's file anymore.

So, normally, you just need to add '"justMyCode": false' and everything will works well.

First, only left this only debug configuration in launch.json file, exclude the debugger take the wrong debug configuration.

Second, If it still not work, you'd better reinstall the 'Python' extension. As debug ability was provided by 'Python' extension. And when you disable this extension, the debug configuration will not recognize 'justMyCode' and some other settings which were provided by 'Python' extension.

And you need to know, some code the debugger can not step into, such as 'os.getcwd()', 'sys.path', and so on.

And if the problem still exists, you'd better disable all the extensions, and just enable the python related extension. Even to create a new project to make a test.

Steven-MSFT
  • 7,438
  • 1
  • 5
  • 13