Skip to content
Advertisement

Google translate in python

When using this code from https://stackabuse.com/text-translation-with-google-translate-api-in-python/

from googletrans import Translator

translator = Translator()

result = translator.translate("Mitä sinä teet")

print(result.src)
print(result.dest)
print(result.origin)
print(result.text)

I get ‘AttributeError: ‘NoneType’ object has no attribute ‘group”, and i was wondering what is wrong, the error seems to be on the ‘result = tra…’ line,

Thank you for any help

Advertisement

Answer

Ok, I was too getting this same error. I think there is a issue in the current release. But the new alpha version worked fine.

First uninstall current version :

pip uninstall googletrans

Then install this one :

pip install googletrans==3.1.0a0
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement