调用parse的时候出现的问题,要处理的.txt文章有点长,会是因为这个问题吗?
‘’’
urllib3.exceptions.SSLError: EOF occurred in violation of protocol (_ssl.c:2427)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File “/home/hongao/.conda/envs/hongao/lib/python3.11/site-packages/requests/adapters.py”, line 667, in send
resp = conn.urlopen(
^^^^^^^^^^^^^
File “/home/hongao/.conda/envs/hongao/lib/python3.11/site-packages/urllib3/connectionpool.py”, line 843, in urlopen
retries = retries.increment(
^^^^^^^^^^^^^^^^^^
File “/home/hongao/.conda/envs/hongao/lib/python3.11/site-packages/urllib3/util/retry.py”, line 519, in increment
raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=‘www.hanlp.com’, port=443): Max retries exceeded with url: /api/parse (Caused by SSLError(SSLEOFError(8, ‘EOF occurred in violation of protocol (_ssl.c:2427)’)))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/home/hongao/Tinystories/script/classify_ba.py”, line 121, in
main()
File “/home/hongao/Tinystories/script/classify_ba.py”, line 117, in main
df = read_sentences(args.input)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/hongao/Tinystories/script/classify_ba.py”, line 20, in read_sentences
result = HanLP.parse(text=sentences,tasks=[‘pos’,‘con’])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/hongao/.conda/envs/hongao/lib/python3.11/site-packages/hanlp_restful/init.py”, line 113, in parse
response = self._send_post_json(self._url + ‘/parse’, {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/hongao/.conda/envs/hongao/lib/python3.11/site-packages/hanlp_restful/init.py”, line 156, in _send_post_json
return json.loads(_post(url, form, headers, self._timeout, verify=self._verify))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/hongao/.conda/envs/hongao/lib/python3.11/site-packages/hanlp_restful/init.py”, line 17, in _post
response = requests.post(url, json=form, headers=headers, timeout=timeout, verify=verify)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/hongao/.conda/envs/hongao/lib/python3.11/site-packages/requests/api.py”, line 115, in post
return request(“post”, url, data=data, json=json, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/hongao/.conda/envs/hongao/lib/python3.11/site-packages/requests/api.py”, line 59, in request
return session.request(method=method, url=url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/hongao/.conda/envs/hongao/lib/python3.11/site-packages/requests/sessions.py”, line 589, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/hongao/.conda/envs/hongao/lib/python3.11/site-packages/requests/sessions.py”, line 703, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/hongao/.conda/envs/hongao/lib/python3.11/site-packages/requests/adapters.py”, line 698, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host=‘www.hanlp.com’, port=443): Max retries exceeded with url: /api/parse (Caused by SSLError(SSLEOFError(8, ‘EOF occurred in violation of protocol (_ssl.c:2427)’)))
‘’’