【问题标题】:The setting ITEM_PIPELINE can't be overridden from terminal无法从终端覆盖设置 ITEM_PIPELINE
【发布时间】:2016-05-27 15:48:08
【问题描述】:

在我的 settings.py 我有:

ITEM_PIPELINES = {
    'turing.pipelines.InitFieldsNotInitializedPipeline': 299,
    'turing.pipelines.SetNoneIfFieldEmptyPipeline': 300,
    'turing.pipelines.CheckCategoryPipeline': 301,
    'turing.pipelines.CheckContactPipeline': 302,
}

而且效果很好。但有时我想在没有任何管道的情况下运行蜘蛛。 当我跑步时

scrapy crawl -s FEED_URI=stdout: -s FEED_FORMAT=json -s ITEM_PIPELINES=[] example_spider

我收到此错误:

return d.iteritems(**kw)
exceptions.AttributeError: 'str' object has no attribute 'iteritems'

如何在没有管道的情况下运行蜘蛛?

到目前为止我尝试过:

scrapy crawl -s FEED_URI=stdout: -s FEED_FORMAT=json -s ITEM_PIPELINES=[] example_spider

scrapy crawl -s FEED_URI=stdout: -s FEED_FORMAT=json -s ITEM_PIPELINES={} example_spider

scrapy crawl -s FEED_URI=stdout: -s FEED_FORMAT=json -s "ITEM_PIPELINES=[]" example_spider

scrapy crawl -s FEED_URI=stdout: -s FEED_FORMAT=json -s "ITEM_PIPELINES={}" example_spider

scrapy crawl -s FEED_URI=stdout: -s FEED_FORMAT=json -s ITEM_PIPELINES=['turing.pipelines.InitFieldsNotInitializedPipeline': 299,] example_spider

scrapy crawl -s FEED_URI=stdout: -s FEED_FORMAT=json -s ITEM_PIPELINES={'turing.pipelines.InitFieldsNotInitializedPipeline': 299,} example_spider

其他组合 查看文档http://doc.scrapy.org/en/latest/topics/settings.html

希望你能帮助我。谢谢。

【问题讨论】:

标签: scrapy scrapy-spider scrapyd scrapy-pipeline


【解决方案1】:

我在github上回答了,但我也放在这里:

你需要像这样转义{}\{\}

scrapy crawl -s FEED_URI=stdout: -s FEED_FORMAT=json -s ITEM_PIPELINES=\{\} -a test_extract_url=http://example.com/ -L ERROR c_example

【讨论】:

    猜你喜欢
    • 2020-03-13
    • 1970-01-01
    • 1970-01-01
    • 2014-01-10
    • 2015-03-12
    • 2017-05-22
    • 2014-03-01
    • 1970-01-01
    • 2017-09-27
    相关资源
    最近更新 更多