Google translate in python

Viewed 299

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

3 Answers

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

I think the problem is with the installation of the library because the code worked fine for me. I would suggest you to uninstall and then reinstall the googletrans library.

enter image description here

Related