Python 2.7 在延迟模式下运行Python时出现未处理的错误

Python 2.7 在延迟模式下运行Python时出现未处理的错误,python-2.7,Python 2.7,windows python版本是2.7.10,而scrapy版本是1.0.1 当我运行scrapy fetch时也会出现这个问题 我不知道怎么解决它 我的代码: items.py: from scrapy.item import Item, Field class StackItem(Item): title = Field() url = Field() stack_spider.py from scrapy import Spider from scrapy.selecto

windows python版本是2.7.10,而scrapy版本是1.0.1 当我运行scrapy fetch时也会出现这个问题 我不知道怎么解决它 我的代码: items.py:

from scrapy.item import Item, Field
class StackItem(Item):


  title = Field()

  url = Field()
stack_spider.py

from scrapy import Spider
from 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')

for 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
错误详细信息:

$ 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:

我认为在
stack\u spider.py
文件中缺少一行:

from stack.items导入StackItem