0

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

希望你能帮助我。谢谢。

4

1 回答 1

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

于 2016-06-24T21:22:28.617 回答