title: scrapy: "YourSpider" object has no attribute 'crawler'
body: <p>I'm building a simple crawler for a project, and I have this error in my code. it runs anyway but I would like to understand and get it sorted out. 
  My spider looks like this:</p>
  
  <pre><code>class BookSpider(scrapy.Spider):
  
  name = "books"
  
  @classmethod
  def from_crawler(cls, crawler):
      return cls(crawler.stats)
  
  def __init__(self, stats):
      self.stats = stats
      self.visited_pages = []
  </code></pre>
  
  <p>And the error message looks like this:</p>
  
  <pre><code>2018-05-23 17:00:50 [scrapy.dupefilters] DEBUG: Filtered duplicate request: &lt;GET https://www.goodreads.com/book/show/35036409-my-brilliant-friend&gt; - no more duplicates will be shown (see DUPEFILTER_DEBUG to show all duplicates)
  2018-05-23 17:00:50 [scrapy.core.scraper] ERROR: Spider error processing &lt;GET https://www.goodreads.com/book/show/17465515-the-story-of-a-new-name&gt; (referer: https://www.goodreads.com/book/show/35036409-my-brilliant-friend)
  Traceback (most recent call last):
    File "/home/m17/elefano/miniconda3/lib/python3.6/site-packages/scrapy/utils/defer.py", line 102, in iter_errback
  yield next(it)
  GeneratorExit
  Unhandled error in Deferred:
  2018-05-23 17:00:50 [twisted] CRITICAL: Unhandled error in Deferred:
  
  2018-05-23 17:00:50 [twisted] CRITICAL: 
  Traceback (most recent call last):
    File "/home/m17/elefano/miniconda3/lib/python3.6/site-packages/twisted/internet/task.py", line 517, in _oneWorkUnit
  result = next(self._iterator)
    File "/home/m17/elefano/miniconda3/lib/python3.6/site-packages/scrapy/utils/defer.py", line 63, in &lt;genexpr&gt;
  work = (callable(elem, *args, **named) for elem in iterable)
    File "/home/m17/elefano/miniconda3/lib/python3.6/site-packages/scrapy/core/scraper.py", line 183, in _process_spidermw_output
  self.crawler.engine.crawl(request=output, spider=spider)
    File "/home/m17/elefano/miniconda3/lib/python3.6/site-packages/scrapy/core/engine.py", line 210, in crawl
  self.schedule(request, spider)
    File "/home/m17/elefano/miniconda3/lib/python3.6/site-packages/scrapy/core/engine.py", line 216, in schedule
  if not self.slot.scheduler.enqueue_request(request):
    File "/home/m17/elefano/miniconda3/lib/python3.6/site-packages/scrapy/core/scheduler.py", line 55, in enqueue_request
  self.df.log(request, self.spider)
    File "/home/m17/elefano/miniconda3/lib/python3.6/site-packages/scrapy/dupefilters.py", line 73, in log
  spider.crawler.stats.inc_value('dupefilter/filtered', spider=spider)
  AttributeError: 'BookSpider' object has no attribute 'crawler'
  </code></pre>
  
  <p>I have a vague idea that it's a problem with the initialization but I can't figure out what's wrong with it. </p>