Open Meet-Li opened 2 years ago
原因应该是我更新了chrome浏览器所致,自行下载对应版本的chromedriver替换后成功运行,问题就在于软件无法自行更新chromedriver了。
手动更新一下chromedriver就可以了 用了好多这个算是比较方便且小体积版本 再出一个目标分数就完美了
重写了get_chromedriver.py - get_download_version 函数 ,就可以自动更新chromedriver了:
def get_download_version(chrome_version): """ 根据本地Chrome版本号获取可下载的ChromeDriver版本号 :param chrome_version: 当前本地Chrome版本号前三位 :return: 完整版本号 """ google_api_url = 'https://registry.npmmirror.com/-/binary/chromedriver/' rep = loads(get(google_api_url).content.decode('utf-8')) df = pd.DataFrame.from_dict(rep).sort_values(by = 'modified',ascending=False) one = df.loc[df['name'].str.contains(chrome_version)].sort_values(by='modified',ascending=False).head(1) download_version = one['name'].values[0][:-1] return download_version
重写了get_chromedriver.py - get_download_version 函数 ,就可以自动更新chromedriver了:
def get_download_version(chrome_version): """ 根据本地Chrome版本号获取可下载的ChromeDriver版本号 :param chrome_version: 当前本地Chrome版本号前三位 :return: 完整版本号 """ google_api_url = 'https://registry.npmmirror.com/-/binary/chromedriver/' rep = loads(get(google_api_url).content.decode('utf-8')) df = pd.DataFrame.from_dict(rep).sort_values(by = 'modified',ascending=False) one = df.loc[df['name'].str.contains(chrome_version)].sort_values(by='modified',ascending=False).head(1) download_version = one['name'].values[0][:-1] return download_version
--> 当前ChromeDriver版本号和Chrome浏览器版本号不一致,准备进行更新 Traceback (most recent call last): File "C:\Users\solif\OneDrive\xuexi\xxqg-master\operation\get_chromedriver.py", line 30, in do latest_version = get_download_version(chrome_version) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\solif\OneDrive\xuexi\xxqg-master\operation\get_chromedriver.py", line 51, in get_download_version df = pd.DataFrame.from_dict(rep).sort_values(by = 'modified',ascending=False) ^^ NameError: name 'pd' is not defined
--> 程序异常,请确保你的chrome浏览器是最新版本,然后重启脚本
重写了get_chromedriver.py - get_download_version 函数 ,就可以自动更新chromedriver了: def get_download_version(chrome_version): """ 根据本地Chrome版本号获取可下载的ChromeDriver版本号 :param chrome_version: 当前本地Chrome版本号前三位 :return: 完整版本号 """ google_api_url = 'https://registry.npmmirror.com/-/binary/chromedriver/' rep = loads(get(google_api_url).content.decode('utf-8')) df = pd.DataFrame.from_dict(rep).sort_values(by = 'modified',ascending=False) one = df.loc[df['name'].str.contains(chrome_version)].sort_values(by='modified',ascending=False).head(1) download_version = one['name'].values[0][:-1] return download_version
--> 当前ChromeDriver版本号和Chrome浏览器版本号不一致,准备进行更新 Traceback (most recent call last): File "C:\Users\solif\OneDrive\xuexi\xxqg-master\operation\get_chromedriver.py", line 30, in do latest_version = get_download_version(chrome_version) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\solif\OneDrive\xuexi\xxqg-master\operation\get_chromedriver.py", line 51, in get_download_version df = pd.DataFrame.from_dict(rep).sort_values(by = 'modified',ascending=False) ^^ NameError: name 'pd' is not defined
--> 程序异常,请确保你的chrome浏览器是最新版本,然后重启脚本
这不是很明显的报错吗,你没有import pandas as pd
之前一直正常运行,今天变成了这样:
--> 当前ChromeDriver版本号和Chrome浏览器版本号不一致,准备进行更新 Traceback (most recent call last): File "operation\get_chromedriver.py", line 30, in do File "operation\get_chromedriver.py", line 61, in get_download_version IndexError: list index out of range
--> 程序异常,请确保你的chrome浏览器是最新版本,然后重启脚本 请按任意键继续. . . Traceback (most recent call last): File "xuexi.py", line 101, in
SystemExit: 1
--> 程序异常,请尝试重启脚本 --> 当前版本:1.0.9.1 请按任意键继续. . .
如果开启梯子后,输出日志为:
File "requests\sessions.py", line 645, in send File "requests\adapters.py", line 517, in send requests.exceptions.SSLError: HTTPSConnectionPool(host='api.github.com', port=443): Max retries exceeded with url: /repos/PRaichu/xxqg/releases/latest (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)')))
--> 请求版本号失败,请检查你的网络环境 --> 此处报错为版本号请求失败,不会影响程序运行,无需关闭程序 --> 当前ChromeDriver版本号和Chrome浏览器版本号不一致,准备进行更新 Traceback (most recent call last): File "urllib3\connectionpool.py", line 700, in urlopen File "urllib3\connectionpool.py", line 994, in _prepare_proxy File "urllib3\connection.py", line 364, in connect File "urllib3\connection.py", line 501, in _connect_tlsproxy File "urllib3\util\ssl.py", line 453, in ssl_wrapsocket File "urllib3\util\ssl.py", line 495, in _ssl_wrap_socket_impl File "ssl.py", line 500, in wrap_socket File "ssl.py", line 1040, in _create File "ssl.py", line 1309, in do_handshake ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1129)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "requests\adapters.py", line 440, in send File "urllib3\connectionpool.py", line 785, in urlopen File "urllib3\util\retry.py", line 592, in increment urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='registry.npmmirror.com', port=443): Max retries exceeded with url: /-/binary/chromedriver/ (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "operation\get_chromedriver.py", line 30, in do File "operation\get_chromedriver.py", line 50, in get_download_version File "requests\api.py", line 75, in get File "requests\api.py", line 61, in request File "requests\sessions.py", line 529, in request File "requests\sessions.py", line 645, in send File "requests\adapters.py", line 517, in send requests.exceptions.SSLError: HTTPSConnectionPool(host='registry.npmmirror.com', port=443): Max retries exceeded with url: /-/binary/chromedriver/ (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)')))
--> 程序异常,请确保你的chrome浏览器是最新版本,然后重启脚本 请按任意键继续. . . Traceback (most recent call last): File "xuexi.py", line 101, in
SystemExit: 1
--> 程序异常,请尝试重启脚本 --> 当前版本:1.0.9.1 请按任意键继续. . .