Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'group' on newly installed library #302

Closed
vega0 opened this issue Jul 10, 2021 · 4 comments

Comments

@vega0
Copy link

vega0 commented Jul 10, 2021

└─$ python3.9 translate_to_other_languages.py Traceback (most recent call last): File "/mnt/d/translate_to_other_languages.py", line 5, in translator.detect('이 문장은 한글로 쓰여졌습니다.') File "/home/kali/.local/lib/python3.9/site-packages/googletrans/client.py", line 255, in detect data = self._translate(text, 'en', 'auto', kwargs) File "/home/kali/.local/lib/python3.9/site-packages/googletrans/client.py", line 78, in _translate token = self.token_acquirer.do(text) File "/home/kali/.local/lib/python3.9/site-packages/googletrans/gtoken.py", line 194, in do self._update() File "/home/kali/.local/lib/python3.9/site-packages/googletrans/gtoken.py", line 62, in _update code = self.RE_TKK.search(r.text).group(1).replace('var ', '') AttributeError: 'NoneType' object has no attribute 'group'

import googletrans
from googletrans.constants import LANGUAGES

translator = googletrans.Translator()
translator.detect('이 문장은 한글로 쓰여졌습니다.')
translator.translate('안녕하세요.')
for short_code in LANGUAGES.keys():
print(short_code)
try:
print(translator.translate("хуй", dest=short_code))
except Exception as e:
print(e)

@epugh
Copy link

epugh commented Jul 10, 2021

I just ran into this as well ;-(

@vega0
Copy link
Author

vega0 commented Jul 10, 2021

I just ran into this as well ;-(

What version on python you use?

@rochanaph
Copy link

rochanaph commented Jul 11, 2021

as mentioned in #234
this worked for me
pip install googletrans==4.0.0-rc1

@vega0
Copy link
Author

vega0 commented Jul 11, 2021

as mentioned in #234
this worked for me
pip install googletrans==4.0.0-rc1

Used version 3.0.0, fixed with forced update to 4.0.0

@vega0 vega0 closed this as completed Jul 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants