请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

重新安装chrome后undetected_chromedriver无法使用

2021-06-13 10:10:53 [undetected_chromedriver.patcher] DEBUG: downloading from https://chromedriver.storage.googleapis.com/91.0.4472.101/chromedriver_win32.zip
2021-06-13 10:10:54 [undetected_chromedriver.patcher] DEBUG: unzipping C:\Users\GJW199~1\AppData\Local\Temp\tmp0sshb_xb
2021-06-13 10:10:54 [undetected_chromedriver.patcher] INFO: patching driver executable C:\Users\gjw199513\appdata\roaming\undetected_chromedriver\chromedriver.exe
2021-06-13 10:10:54 [scrapy.core.engine] ERROR: Error while obtaining start requests
Traceback (most recent call last):
  File "D:\pythonvenv\ArticleSpider\lib\site-packages\scrapy\core\engine.py", line 129, in _next_request
    request = next(slot.start_requests)
  File "D:\pythonProject\ArticleSpider\ArticleSpider\spiders\zhihu.py", line 28, in start_requests
    l = Login(USER, PASSWORD, 6)
  File "D:\pythonProject\ArticleSpider\ArticleSpider\utils\zhihu_login_sel.py", line 228, in __init__
    self.browser = uc.Chrome()
  File "D:\pythonvenv\ArticleSpider\lib\site-packages\undetected_chromedriver\v2.py", line 282, in __init__
    self.browser = subprocess.Popen(
  File "D:\python3.8\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "D:\python3.8\lib\subprocess.py", line 1247, in _execute_child
    args = list2cmdline(args)
  File "D:\python3.8\lib\subprocess.py", line 549, in list2cmdline
    for arg in map(os.fsdecode, seq):
  File "D:\python3.8\lib\os.py", line 816, in fsdecode
    filename = fspath(filename)  # Does type-checking of `filename`.
TypeError: expected str, bytes or os.PathLike object, not NoneType
Exception ignored in: <function Login.__del__ at 0x0FABED60>
Traceback (most recent call last):
  File "D:\pythonProject\ArticleSpider\ArticleSpider\utils\zhihu_login_sel.py", line 340, in __del__
    self.browser.close()
AttributeError: 'Login' object has no attribute 'browser'
2021-06-13 10:10:54 [scrapy.core.engine] INFO: Closing spider (finished)
2021-06-13 10:10:54 [scrapy.statscollectors] INFO: Dumping Scrapy stats:
{'elapsed_time_seconds': 2.202878,
 'finish_reason': 'finished',
 'finish_time': datetime.datetime(2021, 6, 13, 2, 10, 54, 821716),
 'log_count/DEBUG': 3,
 'log_count/ERROR': 1,
 'log_count/INFO': 11,
 'start_time': datetime.datetime(2021, 6, 13, 2, 10, 52, 618838)}
2021-06-13 10:10:54 [scrapy.core.engine] INFO: Spider closed (finished)

如上是报错信息,我怀疑是找不到chrome路径,但是将chrome添加到path依旧无效
麻烦老师帮忙解决一下

正在回答 回答被采纳积分+3

1回答

提问者 慕神3049327 2021-06-13 17:45:04

莫名其妙解决了 不太清楚什么原理 但是主要思路就是重新安装chrome和修改user_data_dir属性

0 回复 有任何疑惑可以回复我~
  • bobby #1
    你这里报错不是因为undetected的问题,而是python代码的问题,代码写的有问题,最好把完整的代码贴出来看看
    回复 有任何疑惑可以回复我~ 2021-06-14 09:02:36
  • 提问者 慕神3049327 回复 bobby #2
    解决了 前一天用的代码还好好地 然后chrome出了问题重新安装就不行了 后来莫名其妙就好了 目前没什么问题了 麻烦老师了
    回复 有任何疑惑可以回复我~ 2021-06-14 10:27:15
  • bobby 回复 提问者 慕神3049327 #3
    好的。
    回复 有任何疑惑可以回复我~ 2021-06-15 15:12:28
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信