Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

closedomain: check if domain was opened successfully before removing not existent task

Daniel Granacc62bba80e91
diff --git a/scrapy/trunk/scrapy/contrib/closedomain.py b/scrapy/trunk/scrapy/contrib/closedomain.py
index bfba4a721..570075a88 100644
--- a/scrapy/trunk/scrapy/contrib/closedomain.py
+++ b/scrapy/trunk/scrapy/contrib/closedomain.py
@@ -43,4 +43,5 @@ class CloseDomain(object):
self.mail.send(self.notify, subj, body)
def domain_closed(self, domain):
- scrapyengine.removetask(self.tasks[domain])
+ if domain in self.tasks:
+ scrapyengine.removetask(self.tasks[domain])