<p dir="auto">I've had a spider running pretty consistently for over a year now and just recently had the following error pop up:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="UserWarning: cookielib bug!
    Traceback (most recent call last):
      File &quot;/usr/lib/python2.7/cookielib.py&quot;, line 1582, in make_cookies
        parse_ns_headers(ns_hdrs), request)
      File &quot;/usr/lib/python2.7/cookielib.py&quot;, line 485, in parse_ns_headers
        v = http2time(_strip_quotes(v))  # None if invalid
      File &quot;/usr/lib/python2.7/cookielib.py&quot;, line 266, in http2time
        return _str2time(day, mon, yr, hr, min, sec, tz)
      File &quot;/usr/lib/python2.7/cookielib.py&quot;, line 176, in _str2time
        t = _timegm((yr, mon, day, hr, min, sec, tz))
      File &quot;/usr/lib/python2.7/cookielib.py&quot;, line 76, in _timegm
        return timegm(tt)
      File &quot;/usr/lib/python2.7/calendar.py&quot;, line 613, in timegm
        days = datetime.date(year, month, 1).toordinal() - _EPOCH_ORD + day - 1
    ValueError: year is out of range
     [cookielib.py:1584]"><pre class="notranslate"><code class="notranslate">UserWarning: cookielib bug!
    Traceback (most recent call last):
      File "/usr/lib/python2.7/cookielib.py", line 1582, in make_cookies
        parse_ns_headers(ns_hdrs), request)
      File "/usr/lib/python2.7/cookielib.py", line 485, in parse_ns_headers
        v = http2time(_strip_quotes(v))  # None if invalid
      File "/usr/lib/python2.7/cookielib.py", line 266, in http2time
        return _str2time(day, mon, yr, hr, min, sec, tz)
      File "/usr/lib/python2.7/cookielib.py", line 176, in _str2time
        t = _timegm((yr, mon, day, hr, min, sec, tz))
      File "/usr/lib/python2.7/cookielib.py", line 76, in _timegm
        return timegm(tt)
      File "/usr/lib/python2.7/calendar.py", line 613, in timegm
        days = datetime.date(year, month, 1).toordinal() - _EPOCH_ORD + day - 1
    ValueError: year is out of range
     [cookielib.py:1584]
</code></pre></div>
<p dir="auto">The problem is that this error crashes the spider process completely. The spider is running within scrapyd.</p>
<p dir="auto">Has anyone seen this before? I'm running Scrapy 0.24.4 on this instance due to an SSL issue that prevented me from upgrading.</p>
<p dir="auto">When using the example from <a href="http://doc.scrapy.org/en/latest/topics/practices.html" rel="nofollow">http://doc.scrapy.org/en/latest/topics/practices.html</a> "Run Scrapy from a script" using Windows XP and Python 2.7 it seems the item_scraped passed signal is not fired. The scraping works and shows in its stats that "item_scraped_count" is 60, yet not a single time the associated function gets called.<br>
I connected it using<br>
crawler.signals.connect(self._item_passed, signal=signals.item_scraped)</p>
<p dir="auto">I also tried<br>
crawler.signals.connect(self._item_passed, signal=signals.item_passed)<br>
dispatcher.connect(self._item_passed_2, signals.item_scraped)<br>
dispatcher.connect(self._item_passed_2, signals.item_passed)<br>
which didn't get called either.</p>
<p dir="auto">item_dropped isn't called either.</p>
<p dir="auto">I have no explicit pipelines defined, just a single basic spider which works fine as seen in the debug logs.</p>
<p dir="auto">Connecting other signals like<br>
crawler.signals.connect(self._spider_opened, signal=signals.spider_opened)<br>
works on the other hand.</p>
<p dir="auto">The main call is:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="def _item_passed(self, item, response, spider):
    print &quot;PASSED&quot;

def _item_passed_2(self, item, response, spider):
    print &quot;PASSED-DISP&quot;

def _item_dropped(self, item, spider, exception):
    print &quot;dropped&quot;

def _spider_opened(spider):
    print &quot;spider opened&quot;

def run(self):
    spider = TestSpider()
    settings = get_project_settings()
    crawler = Crawler(settings)
    crawler.install()
    crawler.signals.connect(reactor.stop, signal=signals.spider_closed)
    crawler.signals.connect(self._item_passed, signal=signals.item_scraped)
    crawler.signals.connect(self._item_passed, signal=signals.item_passed)
    crawler.signals.connect(self._item_dropped, signal=signals.item_dropped)
    crawler.signals.connect(self._spider_opened, signal=signals.spider_opened)
    crawler.configure()
    crawler.crawl(spider)
    dispatcher.connect(self._item_passed_2, signals.item_passed)
    dispatcher.connect(self._item_passed_2, signals.item_scraped)

    crawler.start()

    log.start(loglevel=log.INFO)
    reactor.run()"><pre class="notranslate"><code class="notranslate">def _item_passed(self, item, response, spider):
    print "PASSED"

def _item_passed_2(self, item, response, spider):
    print "PASSED-DISP"

def _item_dropped(self, item, spider, exception):
    print "dropped"

def _spider_opened(spider):
    print "spider opened"

def run(self):
    spider = TestSpider()
    settings = get_project_settings()
    crawler = Crawler(settings)
    crawler.install()
    crawler.signals.connect(reactor.stop, signal=signals.spider_closed)
    crawler.signals.connect(self._item_passed, signal=signals.item_scraped)
    crawler.signals.connect(self._item_passed, signal=signals.item_passed)
    crawler.signals.connect(self._item_dropped, signal=signals.item_dropped)
    crawler.signals.connect(self._spider_opened, signal=signals.spider_opened)
    crawler.configure()
    crawler.crawl(spider)
    dispatcher.connect(self._item_passed_2, signals.item_passed)
    dispatcher.connect(self._item_passed_2, signals.item_scraped)

    crawler.start()

    log.start(loglevel=log.INFO)
    reactor.run()
</code></pre></div>