我的编辑器是PyCharm 2017.3,我的Python版本是3.4。
我试图将点击我的应用程序的单词从英语翻译成印地文
此应用程序从站点中删除单词并列出它。除了翻译功能外,此应用程序的一切正常。
我刚刚安装了googletrans库,但它给了我一个错误,就像最大的重试次数超出了一样。
def translate(self):
translate=Translator()
translate.translate(self._word, dest="hi",src="en")
这是我的翻译功能,这里是我指的documentation。
这是我在控制台中显示的错误。
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\urllib3\connectionpool.py", line 601, in urlopen
chunked=chunked)
File "C:\Python34\lib\site-packages\urllib3\connectionpool.py", line 346, in _make_request
self._validate_conn(conn)
File "C:\Python34\lib\site-packages\urllib3\connectionpool.py", line 850, in _validate_conn
conn.connect()
File "C:\Python34\lib\site-packages\urllib3\connection.py", line 326, in connect
ssl_context=context)
File "C:\Python34\lib\site-packages\urllib3\util\ssl_.py", line 329, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "C:\Python34\Lib\ssl.py", line 344, in wrap_socket
_context=self)
File "C:\Python34\Lib\ssl.py", line 540, in __init__
self.do_handshake()
File "C:\Python34\Lib\ssl.py", line 767, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\requests\adapters.py", line 440, in send
timeout=timeout
File "C:\Python34\lib\site-packages\urllib3\connectionpool.py", line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File "C:\Python34\lib\site-packages\urllib3\util\retry.py", line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='translate.google.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)'),))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/ROCKSTAR/PycharmProjects/Dictionary/execute.py", line 56, in getPerWordDisplay
self.query.value(4), self.query.value(5))
File "C:\Users\ROCKSTAR\PycharmProjects\Dictionary\PerWordWindow.py", line 23, in __init__
self.translate()
File "C:\Users\ROCKSTAR\PycharmProjects\Dictionary\PerWordWindow.py", line 37, in translate
translate.translate(self._word, dest="hi",src="en")
File "C:\Python34\lib\site-packages\googletrans\client.py", line 132, in translate
data = self._translate(text, dest, src)
File "C:\Python34\lib\site-packages\googletrans\client.py", line 57, in _translate
token = self.token_acquirer.do(text)
File "C:\Python34\lib\site-packages\googletrans\gtoken.py", line 180, in do
self._update()
File "C:\Python34\lib\site-packages\googletrans\gtoken.py", line 57, in _update
r = self.session.get(self.host)
File "C:\Python34\lib\site-packages\requests\sessions.py", line 521, in get
return self.request('GET', url, **kwargs)
File "C:\Python34\lib\site-packages\requests\sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "C:\Python34\lib\site-packages\requests\sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "C:\Python34\lib\site-packages\requests\adapters.py", line 506, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='translate.google.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)'),))
Process finished with exit code 0