How to use PyCharm to debug Scrapy projects

后端 未结 10 1435
长发绾君心
长发绾君心 2020-12-02 04:00

I am working on Scrapy 0.20 with Python 2.7. I found PyCharm has a good Python debugger. I want to test my Scrapy spiders using it. Anyone knows how to do that please?

<
10条回答
  •  难免孤独
    2020-12-02 04:19

    Extending @Rodrigo's version of the answer I added this script and now I can set spider name from configuration instead of changing in the string.

    import sys
    from scrapy import cmdline
    
    cmdline.execute(f"scrapy crawl {sys.argv[1]}".split())
    

提交回复
热议问题