Scrapy Crawl run error AttributeError: 'xxxSpider' object has no attribute '_rules' problem-solving

Later, carefully looked at, is not the same as with the official himself rewrote the init initialization method, according to the tips of the log, it should be covered by the init method CrawlSpider but did not call the parent class init led _rules this attribute is not declared lead of. So if our Spider is inherited from CrawlSpider over, and they need to realize __init__ method, remember to call the parent class's __init__ method can guarantee the normal initialization crawlspider properties.
The modified code as follows:

super(TestSpider, self).__init__(*args, **kwargs) It is the key

Guess you like

Origin www.cnblogs.com/jessicor/p/12066550.html