When using this code from https://stackabuse.com/text-translation-with-google-translate-api-in-python/
JavaScript
x
11
11
1
from googletrans import Translator
2
3
translator = Translator()
4
5
result = translator.translate("Mitä sinä teet")
6
7
print(result.src)
8
print(result.dest)
9
print(result.origin)
10
print(result.text)
11
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 :
JavaScript
1
2
1
pip uninstall googletrans
2
Then install this one :
JavaScript
1
2
1
pip install googletrans==3.1.0a0
2