小编Nan*_*ert的帖子

不支持的配置使用标识符""的多个对象(标识符必须是唯一的)

我刚开始使用阵列控制器,所以我对它们的体验非常有限.

我在XCode 4.1中收到此警告:

不支持的配置使用标识符""的多个对象(标识符必须是唯一的)

双引号里面没有任何内容.我正在使用阵列控制器.它出现在我的Table View的每一列中.我检查了每列的绑定.每列都绑定到唯一标识符[ie arrangeObjects.fullName].

一切似乎都很好,我想我可以忽略它.

nstableview nib xcode4

5
推荐指数
0
解决办法
292
查看次数

Scrapy自定义ImagePipeline Settings.py

我已经为我的scrapy项目编写了自己的ImagePipeline.从我的谷歌搜索我得到有关如何在settings.py中设置pipline的不同信息.

假设管道是MyImagesPipeline,它存在于pipelines.py中,其中包含:

class MyImagesPipeline(ImagesPipeline):
    def get_media_requests(self, item, info):
        for image_url in item['image_urls']:
            yield scrapy.Request(image_url)

    def item_completed(self, results, item, info):

        some processing...
        return item
Run Code Online (Sandbox Code Playgroud)

在我的settings.py中:

ITEM_PIPELINES = {
    'scrapy.contrib.pipeline.images.ImagesPipeline': 1,
    'myproject.pipelines.MyImagesPipeline': 100,
   }
Run Code Online (Sandbox Code Playgroud)

我有两个管道,因为如果我单独放入MyImagesPipeline,则调用item_completed但没有任何图像,我得到一个KeyError,因为字段'images'不存在.但是,如果设置中的两个中间件,我将获得同一图像的多个副本.

有人可以请教我这个吗?

编辑:

蜘蛛代码很长,因为我在其中进行了大量的信息处理,但我认为可能是相关部分(解析回调):

def parse_data(self, response):
    img_urls = response.css('.product-image').xpath('.//img/@src').extract()
    img_url = img_urls[0]
    item['image_urls'] = [img_url,]
    yield item
Run Code Online (Sandbox Code Playgroud)

python scrapy

5
推荐指数
1
解决办法
544
查看次数

标签 统计

nib ×1

nstableview ×1

python ×1

scrapy ×1

xcode4 ×1