ssut/py-googletrans

Error when translating text

SteveMan67 opened this issue · 1 comments

Googletrans version:

  • 4.0.0rc1
  • 3.1.0a0
  • 3.0.0
  • 2.x

I'm submitting a ...

  • bug report
  • feature request

Current behavior:

When I enter the code in the code snippet, it gives me an error saying:

Traceback (most recent call last):
  File "C:\Users\***\Documents\Python\Translate Test.py", line 9, in <module>
    text = translator.translate('안녕하세요.')
  File "C:\Users\***\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\***\AppData\Local\Programs\Python\Python310\lib\site-packages\googletrans\client.py", line 78, in _translate
    token = self.token_acquirer.do(text)
  File "C:\Users\***\AppData\Local\Programs\Python\Python310\lib\site-packages\googletrans\gtoken.py", line 194, in do
    self._update()
  File "C:\Users\***\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'

This came from the documentation, so it shouldn't produce an error. I've tried running in both shell and IDLE.
Expected behavior:

To translate the text.
Steps to reproduce:

Following:
Related code:

from googletrans import Translator

translator = Translator()

text = translator.translate('안녕하세요.')

print(text)