无法从终端覆盖设置ITEM_PIPELINE

时间:2016-05-27 15:48:08

标签: scrapy scrapy-spider scrapyd scrapy-pipeline

在我的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

希望你能帮助我。感谢。

1 个答案:

答案 0 :(得分: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