using googletrans to translate spanish to english

427 Views Asked by At

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?

1

There are 1 best solutions below

0
On BEST ANSWER

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