Here is the code:
# coding: utf-8
from googletrans import Translator
translator = Translator()
print translator.translate('here', dest='zh-CN')
everything goes well before today. But not I try to use this python library. then I got this error.
root@localhost:~# python googletest.py
Traceback (most recent call last):
File "googletest.py", line 4, in <module>
print translator.translate(u'here', dest='zh-CN')
File "/usr/local/lib/python2.7/dist-packages/googletrans/client.py", line 132, in translate
data = self._translate(text, dest, src)
File "/usr/local/lib/python2.7/dist-packages/googletrans/client.py", line 57, in _translate
token = self.token_acquirer.do(text)
File "/usr/local/lib/python2.7/dist-packages/googletrans/gtoken.py", line 180, in do
self._update()
File "/usr/local/lib/python2.7/dist-packages/googletrans/gtoken.py", line 59, in _update
code = unicode(self.RE_TKK.search(r.text).group(1)).replace('var ', '')
AttributeError: 'NoneType' object has no attribute 'group'
Does anyone know what is going on? thank you.
here is the library URL https://py-googletrans.readthedocs.io/en/latest/