reference: https://newbedev.com/debugging-scrapy-project-in-visual-studio-code
I've done setting VSCode Debugger for my Scrapy project in work.
This is the launch.json
file for VSCode
{
// 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": "${fileDirname}",
"args": [
"crawl",
"${selectedText}"
],
"console": "integratedTerminal"
}
]
}
All of this codes are completely same with the reference code but only one different thing is it. "${selectedText}"
Instead of input spider's name every single time in order to debugging, You just need dragging on your spider's name string and start Debugging.
This is the output of luauch.json
executed
\..\..> c: && cd \<spider_project_paths>\spiders && cmd /C "\<python_interpreter_paths>\python.exe c:\<vscode_paths>\.vscode\extensions\ms-python.python-2021.11.1422169775\pythonFiles\lib\python\debugpy\launcher 58361 -- -m scrapy crawl test "