-1

Python 3.10.2 (tags/v3.10.2:a58ebcc, Jan 17 2022, 14:12:15) [MSC v.1929 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license()" for more information.

from googletrans import Translator
translator = Translator()
translator.translate('olá, mundo')
Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    translator.translate('olá, mundo')
  File "C:\Users\Fernando\AppData\Local\Programs\Python\Python310\lib\site-packages\googletrans\client.py", line 182, in translate
    data = self._translate(text, dest, src, kwargs)
  File "C:\Users\Fernando\AppData\Local\Programs\Python\Python310\lib\site-packages\googletrans\client.py", line 78, in _translate
    token = self.token_acquirer.do(text)
  File "C:\Users\Fernando\AppData\Local\Programs\Python\Python310\lib\site-packages\googletrans\gtoken.py", line 194, in do
    self._update()
  File "C:\Users\Fernando\AppData\Local\Programs\Python\Python310\lib\site-packages\googletrans\gtoken.py", line 62, in _update
    code = self.RE_TKK.search(r.text).group(1).replace('var ', '')
AttributeError: 'NoneType' object has no attribute 'group'
Terry Jan Reedy
  • 18,414
  • 3
  • 40
  • 52

1 Answers1

0

The traceback shows that line 62 in gtoken.update is not prepared to handle the case that seach return None instead of a match object. Report the code and traceback to the googletrans authors.

Terry Jan Reedy
  • 18,414
  • 3
  • 40
  • 52