python-3.xgoogle-translategoogletrans

using googletrans to translate spanish to english


I am trying to use googletrans to translate some Spanish text to English. I am following the examples & below is my code.

from googletrans import Translator
translator = Translator()
txt = translator.translate('tener', src='es', dest='en')

I get the following error though,

AttributeError: 'NoneType' object has no attribute 'group'

What am I missing?


Solution

  • Seems like the issue is with Google, see the following stackoverflow post: googletrans stopped working with error 'NoneType' object has no attribute 'group'

    This solution worked for me (the accepted doesn't work for me): https://stackoverflow.com/a/65113191/14676920