Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to get VS Code to access other code while debugging

When I am debugging my python code it skips over code not written by me. I've set justmycode to false and I've tried updating request however, it won't accept any values except launch or attach and purpose is set to debug-test. Nothing seems to work.

My JSON file:

 "version": "0.2.0",
   "configurations": [
       {
           "name": "Python: Current File",
           "type": "python",
           "request": "launch",
           "program": "${file}",
           "console": "integratedTerminal",
           "justMyCode":false,
           "purpose": ["debug-test"]
       }
   ]
}

The message from the debugger(yes, I stepped in not over):

Frame skipped from debugging during step-in. Note: may have been skipped because of "justMyCode" option (default == true). Try setting "justMyCode": false in the debug configuration (e.g., launch.json).

Sorry if this a stupid question I am a newbie and feeling totally over my head in my internship.

Literally this is my entire code. The message from the debugger appears when I try to step into execute().

pQuery=p.logquery()
pQuery.execute()
like image 805
Victoria Avatar asked May 29 '26 22:05

Victoria


1 Answers

The official docs on how to do it are here.

The OP was specifically adding a launch configuration for debugging tests. However, over here it's mentioned you should set "request": "test" for "for justMyCode to work with test debugging".

{
  "name": "Python: Debug Tests",
  "type": "python",
  "request": "test",
  "program": "${file}",
  "purpose": ["debug-test"],
  "console": "integratedTerminal",
  "justMyCode": false
}

Which is not so clearly explained in the official docs... but worked for me.


In the most recent documentation, "test" is no longer a valid value for "request". The following is recommended and worked for me:

{
  "name": "Python: Debug Tests",
  "type": "python",
  "request": "launch",
  "program": "${file}",
  "purpose": ["debug-test"],
  "console": "integratedTerminal",
  "justMyCode": false
}
like image 177
Donal Avatar answered Jun 01 '26 00:06

Donal