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

when i run the demo code, raise a error as following: #385

Closed
shichg opened this issue Aug 31, 2023 · 3 comments
Closed

when i run the demo code, raise a error as following: #385

shichg opened this issue Aug 31, 2023 · 3 comments

Comments

@shichg
Copy link

shichg commented Aug 31, 2023

Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevconsole.py", line 364, in runcode
coro = func()
^^^^^^
File "", line 1, in
File "/Users/mac/miniconda3/envs/Py311/lib/python3.11/site-packages/googletrans/client.py", line 194, in translate
data, response = self._translate(text, dest, src)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mac/miniconda3/envs/Py311/lib/python3.11/site-packages/googletrans/client.py", line 122, in _translate
if r.status_code != 200 and self.raise_Exception:
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Translator' object has no attribute 'raise_Exception'. Did you mean: 'raise_exception'?

@amirroox
Copy link

it can be installed like this:
pip install googletrans==4.0.0rc1

Use :

translator = Translator()
translation = translator.translate("سلام دوست عزیز", dest='en')
print(translation.text)
#output: 'Hello Dear Friend'

Link : #234 (comment)

Ref : https://stackoverflow.com/questions/52455774/googletrans-stopped-working-with-error-nonetype-object-has-no-attribute-group

@pntha
Copy link

pntha commented Sep 8, 2023

it can be installed like this: pip install googletrans==4.0.0rc1

Use :

translator = Translator()
translation = translator.translate("سلام دوست عزیز", dest='en')
print(translation.text)
#output: 'Hello Dear Friend'

Link : #234 (comment)

Ref : https://stackoverflow.com/questions/52455774/googletrans-stopped-working-with-error-nonetype-object-has-no-attribute-group

This issue doesn't fix the above issue. I'm also running 4.0.0rc1 and encountered the same issue. I imagine it's an easy fix to change the capitalisation but I would like the project I'm working onto be portable and changing it in each environment is too much.

@PrashantDixit0
Copy link

I uninstalled previous googletrans and installed using following command
pip install googletrans==4.0.0rc1

after that it works for me.

For detailed explaination of problem refer https://stackoverflow.com/questions/52455774/googletrans-stopped-working-with-error-nonetype-object-has-no-attribute-group

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants