I am currently working on a translator in Python 3.8.5 but I am not getting an appropriate result. My code thus far is
from googletrans import Translator
text = '''Vous êtes français'''
translator = Translator()
dt = translator.detect(text)
print(dt)
In my terminal, I should be getting the source and the destination
which is fr for Source and en for dt but instead what I am getting is this error I have no idea how to fix.
Traceback (most recent call last):
File "c:/Users/Akash/Desktop/Learning python/Project10-MegaProject-Translator.py", line 5, in <module>
dt = translator.detect(text)
File "C:\Users\Akash\AppData\Local\Programs\Python\Python38-32\lib\site-packages\googletrans\client.py", line 255, in detect
data = self._translate(text, 'en', 'auto', kwargs)
File "C:\Users\Akash\AppData\Local\Programs\Python\Python38-32\lib\site-packages\googletrans\client.py", line 78, in _translate
token = self.token_acquirer.do(text)
File "C:\Users\Akash\AppData\Local\Programs\Python\Python38-32\lib\site-packages\googletrans\gtoken.py", line 194, in do
self._update()
File "C:\Users\Akash\AppData\Local\Programs\Python\Python38-32\lib\site-packages\googletrans\gtoken.py", line 54, in _update
r = self.client.get(self.host)
File "C:\Users\Akash\AppData\Local\Programs\Python\Python38-32\lib\site-packages\httpx\_client.py", line 755, in get
return self.request(
File "C:\Users\Akash\AppData\Local\Programs\Python\Python38-32\lib\site-packages\httpx\_client.py", line 600, in request
return self.send(
File "C:\Users\Akash\AppData\Local\Programs\Python\Python38-32\lib\site-packages\httpx\_client.py", line 620, in send
response = self.send_handling_redirects(
File "C:\Users\Akash\AppData\Local\Programs\Python\Python38-32\lib\site-packages\httpx\_client.py", line 647, in send_handling_redirects
response = self.send_handling_auth(
File "C:\Users\Akash\AppData\Local\Programs\Python\Python38-32\lib\site-packages\httpx\_client.py", line 684, in send_handling_auth
response = self.send_single_request(request, timeout)
File "C:\Users\Akash\AppData\Local\Programs\Python\Python38-32\lib\site-packages\httpx\_client.py", line 714, in send_single_request
) = transport.request(
File "C:\Users\Akash\AppData\Local\Programs\Python\Python38-32\lib\site-packages\httpcore\_sync\connection_pool.py", line 152, in request
response = connection.request(
File "C:\Users\Akash\AppData\Local\Programs\Python\Python38-32\lib\site-packages\httpcore\_sync\connection.py", line 65, in request
self.socket = self._open_socket(timeout)
File "C:\Users\Akash\AppData\Local\Programs\Python\Python38-32\lib\site-packages\httpcore\_sync\connection.py", line 85, in _open_socket
return self.backend.open_tcp_stream(
File "C:\Users\Akash\AppData\Local\Programs\Python\Python38-32\lib\site-packages\httpcore\_backends\sync.py", line 139, in open_tcp_stream
return SyncSocketStream(sock=sock)
File "C:\Users\Akash\AppData\Local\Programs\Python\Python38-32\lib\contextlib.py", line 131, in __exit__
self.gen.throw(type, value, traceback)
File "C:\Users\Akash\AppData\Local\Programs\Python\Python38-32\lib\site-packages\httpcore\_exceptions.py", line 12, in map_exceptions
raise to_exc(exc) from None
httpcore._exceptions.ConnectTimeout: _ssl.c:1106: The handshake operation timed out
PS C:\Users\Akash\Desktop\Learning python>