Python scrapy run with Unhandled error in Deferred -


windows python version 2.7.10 scrapy version 1.0.1 when run scrapy fetch http://google.com:81 appear problem , don't konw how solve code: items.py:

from scrapy.item import item, field class stackitem(item):     title = field()    url = field() 

stack_spider.py

from scrapy import spider scrapy.selector import selector   class stackspider(spider):    name = "stack"    allowed_domains = ["stackoverflow.com"]    start_urls = ["http://stackoverflow.com/questions?pagesize=50&sort=newest", ]     def parse(self, response): questions = selector(response).xpath('//div[@class="summary"]/h3')  question in questions:   item = stackitem()   item['title'] = question.xpath(       'a[@class="question-hyperlink"]/text()').extract()[0]   item['url'] = question.xpath(       'a[@class="question-hyperlink"]/@href').extract()[0]   yield item 

the error detail:

$ scrapy crawl stack 2015-07-07 16:26:26 [scrapy] info: scrapy 1.0.1 started (bot: stack)  2015-07-07 16:26:26 [scrapy] info: optional features available: ssl, http11  2015-07-07 16:26:26 [scrapy] info: overridden settings: {'newspider_module': `'stack.spiders', 'spider_modules': ['stack.spiders'], 'bot_name': 'stack'}`  2015-07-07 16:26:27 [scrapy] info: enabled extensions: closespider, `telnetconsole, logstats, corestats, spiderstate`  unhandled error in deferred:  2015-07-07 16:26:28 [twisted] critical: unhandled error in deferred:  2015-07-07 16:26:28 [twisted] critical: 

i think in stack_spider.py file missing line:

from stack.items import stackitem


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -