AttributeError: 'Chrome' object has no attribute 'keep_user_data_dir'
来源:2-1 pycharm的安装和简单使用
慕慕65597133
2021-09-06
Traceback (most recent call last):
File “/home/wyx/anaconda3/envs/tf2/lib/python3.8/site-packages/scrapy/core/engine.py”, line 129, in _next_request
request = next(slot.start_requests)
File “/home/wyx/python/project/news/news/spiders/zhihu.py”, line 17, in start_requests
l = Login(USER, PASSWORD, 6)
File “/home/wyx/python/project/news/news/utils/zhihu_log_sel.py”, line 222, in init
self.browser = uc.Chrome()
File “/home/wyx/anaconda3/envs/tf2/lib/python3.8/site-packages/undetected_chromedriver/v2.py”, line 152, in init
patcher.auto()
File “/home/wyx/anaconda3/envs/tf2/lib/python3.8/site-packages/undetected_chromedriver/patcher.py”, line 104, in auto
self.unzip_package(self.fetch_package())
File “/home/wyx/anaconda3/envs/tf2/lib/python3.8/site-packages/undetected_chromedriver/patcher.py”, line 141, in fetch_package
return urlretrieve(u)[0]
File “/home/wyx/anaconda3/envs/tf2/lib/python3.8/urllib/request.py”, line 286, in urlretrieve
raise ContentTooShortError(
urllib.error.ContentTooShortError: <urlopen error retrieval incomplete: got only 5865472 out of 5980285 bytes>
Exception ignored in: <function Chrome.del at 0x7f676c089f70>
Traceback (most recent call last):
File “/home/wyx/anaconda3/envs/tf2/lib/python3.8/site-packages/undetected_chromedriver/v2.py”, line 590, in del
self.quit()
File “/home/wyx/anaconda3/envs/tf2/lib/python3.8/site-packages/undetected_chromedriver/v2.py”, line 573, in quit
if not self.keep_user_data_dir or self.keep_user_data_dir is False:
AttributeError: ‘Chrome’ object has no attribute 'keep_user_data_dir’
Exception ignored in: <function Login.del at 0x7f676c090820>
Traceback (most recent call last):
File “/home/wyx/python/project/news/news/utils/zhihu_log_sel.py”, line 332, in del
self.browser.close()
AttributeError: ‘Login’ object has no attribute ‘browser’
我是3.8的环境
1回答
-
bobby
2021-09-07
这里异常栈非常清楚的说明了是哪一行代码的问题以及原因。也就是没有这个browser,注释掉真一行再试试
00