直到昨晚,当最后一次尝试安装时,代码运行良好,我没有做任何更改。然后,当我再次运行我的程序时,我从终端得到了这个Traceback:
<snip>
cd_service_obj = Service(ChromeDriverManager().install())
File "C:...my_venvlibsite-packageswebdriver_managerchrome.py", line 39, in install
driver_path = self._get_driver_path(self.driver)
File "C:...my_venvlibsite-packageswebdriver_managercoremanager.py", line 26, in _get_driver_path
binary_path = self.driver_cache.find_driver(driver)
File "C:...my_venvlibsite-packageswebdriver_managercoredriver_cache.py", line 101,
in find_driver
metadata = self.get_metadata()
File "C:...my_venvlibsite-packageswebdriver_managercoredriver_cache.py", line 135,
in get_metadata
return json.load(outfile)
File "C:UsersmyselfAppDataLocalProgramsPythonPython310libjson__init__.py", line 293, in load
return loads(fp.read(),
File "C:UsersmyselfAppDataLocalProgramsPythonPython310libjson__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "C:UsersmyselfAppDataLocalProgramsPythonPython310libjsondecoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:UsersmyselfAppDataLocalProgramsPythonPython310libjsondecoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
我重建了整个虚拟环境,但仍然出现了这个错误。是什么原因导致的,我该如何修复?
在得到更好的答案之前,我只是没有在Chrome()
对象中包含service
参数,并注释掉了创建Service()
对象的代码行;固定的";