【问题标题】:ReactorNotRestartable error using CrawlerRunner in scrapy在scrapy中使用CrawlerRunner的ReactorNotRestartable错误
【发布时间】:2017-05-25 09:26:41
【问题描述】:

我使用了与文档中相同的代码,只是在使用设置实例化 Crawlrunner 方面略有不同,这样它就不会错过管道操作。如果不使用它会正常工作,但会跳过管道。

from twisted.internet import reactor
import scrapy
from scrapy.crawler import CrawlerRunner
from scrapy.utils.log import configure_logging
from forspef_scrapper import ForspefScrapper
from scrapy.utils.project import get_project_settings

configure_logging({'LOG_FORMAT': '%(levelname)s: %(message)s'})
runner = CrawlerRunner(get_project_settings())

d = runner.crawl(ForspefScrapper)
d.addBoth(lambda _: reactor.stop())
reactor.run()

请提出此问题的原因和可能的解决方法。

【问题讨论】:

    标签: python scrapy twisted


    【解决方案1】:

    删除reactor.stop 的回调,您应该不会再看到该问题。反应堆设计为始终运行

    【讨论】:

    • 感谢您的建议,但我需要循环运行蜘蛛,如果回调被删除,那么它不会停止爬虫。
    • 您的项目中是否还有reactor.stop
    猜你喜欢
    • 1970-01-01
    • 2017-02-18
    • 2018-12-13
    • 2017-07-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多