scrapy“错误:无法读取实例数据,放弃”

时间:2016-04-15 10:36:46

标签: python scrapy web-crawler

我正在尝试关注scrapy.org上的简单教程(http://doc.scrapy.org/en/latest/intro/tutorial.html

所以我有itemps.py

import scrapy

class DmozItem(scrapy.Item):
    title = scrapy.Field()
    link = scrapy.Field()
    desc = scrapy.Field()

和dmoz_spider.py

import scrapy

class DmozSpider(scrapy.Spider):
    name = "dmoz"
    allowed_domains = ["dmoz.org"]
    start_urls = [
        "http://www.dmoz.org/Computers/Programming/Languages/Python/Books/",
        "http://www.dmoz.org/Computers/Programming/Languages/Python/Resources/"
    ]

    def parse(self, response):
        filename = response.url.split("/")[-2] + '.html'
        with open(filename, 'wb') as f:
            f.write(response.body)

But I get this terminal with errors

我使用PowerShell。 Scrapy 1.0.5和Python 2.7.11 | Anaconda 4.0.0(64位)| (默认,2016年2月16日,09:58:36)[MSC v.1500 64位(AMD64)]在win32上

1 个答案:

答案 0 :(得分:1)

尝试将此代码添加到settings.py文件中。

DOWNLOAD_HANDLERS = {
  's3': None,
}

或更新scrapy,此版本issue已在1.1版中修复