Catch start_requests iterator errors. refs #83

This commit is contained in:
Daniel Graña 2012-01-27 17:41:38 -02:00
parent 2fbd662ab7
commit 454a21db90
1 changed files with 5 additions and 1 deletions

View File

@ -106,9 +106,13 @@ class ExecutionEngine(object):
if slot.start_requests and not self._needs_backout(spider):
try:
request = slot.start_requests.next()
self.crawl(request, spider)
except StopIteration:
slot.start_requests = None
except Exception, exc:
log.err(None, 'Obtaining request from start requests', \
spider=spider)
else:
self.crawl(request, spider)
if self.spider_is_idle(spider) and slot.close_if_idle:
self._spider_idle(spider)