We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0d368c5 commit 0349bbfCopy full SHA for 0349bbf
scrapy/extensions/spiderstate.py
@@ -2,6 +2,7 @@
2
from six.moves import cPickle as pickle
3
4
from scrapy import signals
5
+from scrapy.exceptions import NotConfigured
6
from scrapy.utils.job import job_dir
7
8
class SpiderState(object):
@@ -12,7 +13,11 @@ def __init__(self, jobdir=None):
12
13
14
@classmethod
15
def from_crawler(cls, crawler):
- obj = cls(job_dir(crawler.settings))
16
+ jobdir = job_dir(crawler.settings)
17
+ if not jobdir:
18
+ raise NotConfigured
19
+
20
+ obj = cls(jobdir)
21
crawler.signals.connect(obj.spider_closed, signal=signals.spider_closed)
22
crawler.signals.connect(obj.spider_opened, signal=signals.spider_opened)
23
return obj
0 commit comments