Last modified: Jan 10, 2023 By Alexander Williams

How to solve googletrans AttributeError: 'NoneType' object has no attribute 'group' error

Probably you got AttributeError: 'NoneType' object has no attribute 'group' error because you are using the official googletrans version.

As you know, Google makes updates on its Api services every couple of months, and the official googletrans version no longer compatible with the Google API service.

To solve this issue, you need to install the alpha version.

Solving the issue

Uninstall the official version:


pip uninstall googletrans

Install the alpha version


pip install googletrans==3.1.0a0

Test the program


from googletrans import Translator

detector = Translator()

dec_lan = detector.detect('이 문장은 한글로 쓰여졌습니다.')

print(dec_lan)

Output


Detected(lang=ko, confidence=1.0)