AttributeError: 'XidianInfoSpider' object has no attribute '_rules'

20 views
Skip to first unread message

Jianhua Zhu

unread,
Apr 12, 2017, 7:48:59 AM4/12/17
to scrapy-users
hi,guys!
    when i use this spider https://github.com/PascoCoder/XidianInfo  i get this error info:AttributeError: 'XidianInfoSpider' object has no attribute '_rules',thx for suggestion.
2017-04-08 19:22:30 [scrapy.utils.log] INFO: Scrapy 1.3.3 started (bot: XidianInfo)
2017-04-08 19:22:30 [scrapy.utils.log] INFO: Overridden settings: {'NEWSPIDER_MODULE': 'XidianInfo.spiders', 'SPIDER_MODULES': ['XidianInfo.spiders'], 'BOT_NAME': 'XidianInfo', 'AUTOTHROTTLE_ENABLED': True}
2017-04-08 19:22:30 [scrapy.middleware] INFO: Enabled extensions:
['scrapy.extensions.logstats.LogStats',
 
'scrapy.extensions.telnet.TelnetConsole',
 
'scrapy.extensions.corestats.CoreStats',
 
'scrapy.extensions.throttle.AutoThrottle']
2017-04-08 19:22:31 [scrapy.middleware] INFO: Enabled downloader middlewares:
['scrapy.downloadermiddlewares.httpauth.HttpAuthMiddleware',
 
'scrapy.downloadermiddlewares.downloadtimeout.DownloadTimeoutMiddleware',
 
'scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware',
 
'scrapy.downloadermiddlewares.useragent.UserAgentMiddleware',
 
'XidianInfo.middlewares.mymiddleware.MyCustomDownloaderMiddleware',
 
'scrapy.downloadermiddlewares.retry.RetryMiddleware',
 
'scrapy.downloadermiddlewares.redirect.MetaRefreshMiddleware',
 
'scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware',
 
'scrapy.downloadermiddlewares.redirect.RedirectMiddleware',
 
'scrapy.downloadermiddlewares.cookies.CookiesMiddleware',
 
'scrapy.downloadermiddlewares.stats.DownloaderStats']
2017-04-08 19:22:31 [scrapy.middleware] INFO: Enabled spider middlewares:
['scrapy.spidermiddlewares.httperror.HttpErrorMiddleware',
 
'scrapy.spidermiddlewares.offsite.OffsiteMiddleware',
 
'scrapy.spidermiddlewares.referer.RefererMiddleware',
 
'scrapy.spidermiddlewares.urllength.UrlLengthMiddleware',
 
'scrapy.spidermiddlewares.depth.DepthMiddleware']
2017-04-08 19:22:31 [scrapy.middleware] INFO: Enabled item pipelines:
['XidianInfo.pipelines.pipelines.ImagePipeline']
2017-04-08 19:22:31 [scrapy.core.engine] INFO: Spider opened
2017-04-08 19:22:31 [scrapy.extensions.logstats] INFO: Crawled 0 pages (at 0 pages/min), scraped 0 items (at 0 items/min)
2017-04-08 19:22:31 [scrapy.extensions.telnet] DEBUG: Telnet console listening on 127.0.0.1:6023
000000000000000000000000
2017-04-08 19:22:31 [scrapy.core.engine] DEBUG: Crawled (200) <GET http://info.xidian.edu.cn/info/1010/8713.htm> (referer: None)
2017-04-08 19:22:31 [scrapy.core.scraper] ERROR: Spider error processing <GET http://info.xidian.edu.cn/info/1010/8713.htm> (referer: None)
Traceback (most recent call last):
 
File "/usr/local/lib/python2.7/dist-packages/scrapy/utils/defer.py", line 102, in iter_errback
   
yield next(it)
 
File "/usr/local/lib/python2.7/dist-packages/scrapy/spidermiddlewares/offsite.py", line 29, in process_spider_output
   
for x in result:
 
File "/usr/local/lib/python2.7/dist-packages/scrapy/spidermiddlewares/referer.py", line 22, in <genexpr>
   
return (_set_referer(r) for r in result or ())
 
File "/usr/local/lib/python2.7/dist-packages/scrapy/spidermiddlewares/urllength.py", line 37, in <genexpr>
   
return (r for r in result or () if _filter(r))
 
File "/usr/local/lib/python2.7/dist-packages/scrapy/spidermiddlewares/depth.py", line 58, in <genexpr>
   
return (r for r in result or () if _filter(r))
 
File "/usr/local/lib/python2.7/dist-packages/scrapy/spiders/crawl.py", line 78, in _parse_response
   
for request_or_item in self._requests_to_follow(response):
 
File "/usr/local/lib/python2.7/dist-packages/scrapy/spiders/crawl.py", line 55, in _requests_to_follow
   
for n, rule in enumerate(self._rules):
AttributeError: 'XidianInfoSpider' object has no attribute '_rules'
2017-04-08 19:22:31 [scrapy.core.engine] INFO: Closing spider (finished)
2017-04-08 19:22:31 [scrapy.statscollectors] INFO: Dumping Scrapy stats:
{'downloader/request_bytes': 234,
 
'downloader/request_count': 1,
 
'downloader/request_method_count/GET': 1,
 
'downloader/response_bytes': 10955,
 
'downloader/response_count': 1,
 
'downloader/response_status_count/200': 1,
 
'finish_reason': 'finished',
 
'finish_time': datetime.datetime(2017, 4, 8, 11, 22, 31, 340892),
 
'log_count/DEBUG': 2,
 
'log_count/ERROR': 1,
 
'log_count/INFO': 7,
 
'response_received_count': 1,
 
'scheduler/dequeued': 1,
 
'scheduler/dequeued/memory': 1,
 
'scheduler/enqueued': 1,
 
'scheduler/enqueued/memory': 1,
 
'spider_exceptions/AttributeError': 1,
 
'start_time': datetime.datetime(2017, 4, 8, 11, 22, 31, 67155)}
2017-04-08 19:22:31 [scrapy.core.engine] INFO: Spider closed (finished)
Enter code here...



Reply all
Reply to author
Forward
0 new messages