我是靠谱客的博主 飞快小兔子,这篇文章主要介绍Watch1Spider' object has no attribute '_rules',现在分享给大家,希望可以做个参考。

报错如下:

File “/usr/local/lib/python3.5/dist-packages/scrapy/spiders/crawl.py”, line 60, in _requests_to_follow
for n, rule in enumerate(self._rules):
AttributeError: ‘Watch1Spider’ object has no attribute ‘_rules’

原因:

复制代码
1
2
3
4
5
6
7
class Watch1Spider(CrawlSpider): # @classmethod def __init__(self): self.driver = webdriver.Chrome() self.header = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134'}

CrawlSpider不支持def init(self):,目前我还没想到有什么解决办法,以后再说吧,希望大佬们可以支招。

最后

以上就是飞快小兔子最近收集整理的关于Watch1Spider' object has no attribute '_rules'的全部内容,更多相关Watch1Spider'内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(69)

评论列表共有 0 条评论

立即
投稿
返回
顶部