1

I know this question has been asked in the past but none of the previous answers have helped me. I'm writing a program using Scrapy to parse some web data and, for now, store it in JSON files. My debugging for a while was working fine, but I stopped working on the project, came back to it a few weeks later, and found that I couldn't get it to stop on any of my debug points.

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": "Crawl with scrapy",
            "type": "python",
            "request": "launch",
            "module": "scrapy",
            "cwd": "${workspaceFolder}/DSRCrawler/DSRCrawler/spiders",
            "args": [
                "crawl",
                "dsrSpider",
                "-a",
                "start=10/1/2022",
                "-a",
                "end=10/2/2022",
            ],
            "console": "internalConsole"
        }
    ]
}

From the Debug tab in VS Code, I try hitting the Play button that appears next to "RUN AND DEBUG" in the UI and tried the "Run" menu tab and selected "Start Debugging".

I've tried deleting the launch.json file and creating it again, I've tried reinstalling VS Code. I've tried the suggestion of adding the "justMyCode": false which doesn't seem to make a difference.

I have tried the solutions in the following links to no avail:

One thing I finally found that works is using debugpy

import debugpy
...
debugpy.breakpoint()

But I'm confused why I should have to use this rather than the built in debugging and breakpoints. None of the other scrapy-specific solutions mention debugpy.

Asif
  • 748
  • 3
  • 9
  • 32
  • Have you tried to click the run button on the right side of run and debug after adding `"justMyCode": false`? – MingJie-MSFT Dec 05 '22 at 02:26
  • How are you creating the breakpoints? What answers did you already read? Please add the links. If you want more tips, check out [How to ask a good question](/help/how-to-ask). – wjandrea Dec 05 '22 at 02:28
  • @MingJie-MSFT after adding the justMyCode setting, I have of course tried hitting the run button on the right side of run and debug. I have tried all the ways you can trigger a run in debug mode. – Asif Dec 05 '22 at 05:35
  • @wjandrea i am creating in-line breakpoints using VS Code's UI - meaning the red dots that appear to the left of the line number. – Asif Dec 05 '22 at 05:36
  • @Asif Can [this answer](https://stackoverflow.com/a/67185092/18359438) solve your issue? – MingJie-MSFT Dec 05 '22 at 05:39
  • @MingJie-MSFT thanks but i'm not running tests in this case. I did try adding `"env": {"PYTEST_ADDOPTS": "--no-cov"}` to my launch.json, along with the `"justMyCode": false` and I see no change - attempting to debug just runs the program straight through without breaking. – Asif Dec 05 '22 at 05:46
  • This is really beyond my understanding of debugging. Can you provide a minimum case to let me reproduce this problem in my vscode. You can also try the method of downgrading python mentioned in the article. – MingJie-MSFT Dec 05 '22 at 05:50

0 Answers0