最佳答案
我正在尝试 googletrans
,它工作得很好。从今天早上开始,我开始得到以下错误。我浏览了很多来自 stackoverflow 和其他网站的帖子,发现我的 IP 可能被禁止在某个时候使用这项服务。我尝试使用多个服务提供商的互联网,有不同的知识产权,仍然面临同样的问题?我也尝试在不同的笔记本电脑上使用 googletrans
,仍然是同样的问题。.是 googletrans
软件包坏了还是谷歌做了什么在他们的结束?
>>> from googletrans import Translator
>>> translator = Translator()
>>> translator.translate('안녕하세요.')
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
translator.translate('안녕하세요.')
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/googletrans/client.py", line 172, in translate
data = self._translate(text, dest, src)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/googletrans/client.py", line 75, in _translate
token = self.token_acquirer.do(text)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/googletrans/gtoken.py", line 180, in do
self._update()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-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'