我在Windows机上使用Visual Studio Code,正在编写一个新的Scrapy爬虫程序。这个爬虫程序已经可以正常工作了,但是我想要调试代码,因此我需要在launch.json
文件中添加以下内容:
{
"name": "Scrapy with Integrated Terminal/Console",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "${config:python.pythonPath}",
"program": "C:/Users/neo/.virtualenvs/Gers-Crawler-77pVkqzP/Scripts/scrapy.exe",
"cwd": "${workspaceRoot}",
"args": [
"crawl",
"amazon",
"-o",
"amazon.json"
],
"console": "integratedTerminal",
"env": {},
"envFile": "${workspaceRoot}/.env",
"debugOptions": [
"RedirectOutput"
]
}
但是我无法触发任何断点。
PS:我从这里获取了JSON脚本:http://www.stevetrefethen.com/blog/debugging-a-python-scrapy-project-in-vscode