Quantcast
Channel: Debugging Scrapy Project in Visual Studio Code - Stack Overflow
Viewing all articles
Browse latest Browse all 9

Answer by gisman for Debugging Scrapy Project in Visual Studio Code

$
0
0

I applied @fmango's code and improve it.

  1. Instead of write a seperated runner file, just paste these code lines at the end of spider.

  2. run python debugger. that's all

if __name__ == '__main__':    import os    from scrapy.cmdline import execute    os.chdir(os.path.dirname(os.path.realpath(__file__)))    SPIDER_NAME = MySpider.name    try:        execute(            ['scrapy','crawl',                SPIDER_NAME,'-s','FEED_EXPORT_ENCODING=utf-8',            ]        )    except SystemExit:        pass

Viewing all articles
Browse latest Browse all 9

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>