-
Notifications
You must be signed in to change notification settings - Fork 706
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' #48
Comments
Have you found a solution? |
This means google banned your IP. |
Wrong, this happens when Google directly sends you the raw token. They do this for a short time after maintenance, not sure why. |
Hi, from yesterday I have this "error". How do you think that I could fix it. I just created other server to execute my code and the result it's the same :( Thanks |
See here for the fix: #78 |
Perfect! Thanks so much @Darkblader24! This work now for me! |
how to use it for translation code above? |
go to browser with Google Translate page, try to translate Hello World =) |
I have tried to translate from Google Translate page and it works. But when I try code above it failed with same error as shown above. |
Can I use the code with the translation code by @halleyshx ? |
After applying #78 I got below error. Please help
ValueError: No JSON object could be decoded |
Looking other places, probably the issue is around a Regex from Google Translate than they use to working on. Take a look in: pndurette/gTTS#138 |
Apologies, I just installed this library via pip and encountered this error. How should I proceed to apply said fix? |
hello, I try today to use the gtts on python but is not working the error is: Exception has occurred: OSError My code: import speech_recognition as sr while True: command = 0 mic = sr.Microphone() try: except sr.UnknownValueError: except sr.RequestError: if "hello" in command: |
@Creator-360 , your code is under gTTS project, please take a look in: |
same to me TAT |
@Darkblader24 My IP is also getting blocked after using the pull request [(https://github.com//pull/78)], although it resolved the "None Type" issue. It happens after 250 requests or something, I have even tried on a different server, the IP is continuously getting blocked after few requests. Earlier I could make thousands of requests and my IP never got blocked. The new pull request has messed up something, any idea? |
Quick question: What is the error you get when your IP is blocked? Is it |
The error when the IP is blocked is Any idea how to unblock my IP address ? |
@ramya-ramanathan I am getting ValueError: No JSON object could be decoded |
Hello |
I've been getting this as well on a recent install of File "<truncated_for_privacy>/lib/python3.6/site-packages/googletrans/client.py", line 182, in translate
data = self._translate(text, dest, src, kwargs)
File "<truncated_for_privacy>/lib/python3.6/site-packages/googletrans/client.py", line 78, in _translate
token = self.token_acquirer.do(text)
File "<truncated_for_privacy>/lib/python3.6/site-packages/googletrans/gtoken.py", line 194, in do
self._update()
File "<truncated_for_privacy>/lib/python3.6/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' |
me, too. |
still problem exist :'( |
- AttributeError: 'NoneType' object has no attribute 'group' - ssut/py-googletrans#48
- AttributeError: 'NoneType' object has no attribute 'group' - ssut/py-googletrans#48
Still having this issue too frequently. Impacting our production. For days we thought we've been doing something wrong... |
I am seeing this issue as well. I see it on dev and staging environment but not in production. |
Getting the same "Attribute Error" after GoogleTrans had been working great for months...
|
I've been using this library to do research work, where I have to translate several images, at first I thought it was an error in the images because they have different edges and colors, but then I used a time delay for some images that did not work and suddenly they started translating. The problem is that it does not work for all the images, below I show how I use the delay
|
I'm also getting the same issue, any fix for this?
I'm using Python 3.7.3 on Ubuntu 20.04 machine |
Hey there, In another 2 years old thread talking about this issue (which sadly, I cannot find again) it was mentioned that upgrading GoogleTrans helps. It has helped for me too, but only for a short while. In other old threads I have found, it was mentioned, that an older version of the issue was related to a problem with an API key, token or similar. So my theory is that I get another key if I update. Even when there isn't a new version, Anaconda will re-download and install the package. At least you can give it a shot. It is quite easy - run this in Anaconda:
|
Hi, I get the same error. Python version 3.8.3 |
It´s not work. Still the error:
|
You can simply overcome this issue by using error handling like so:
|
Won't this go in infinite loop? |
For some reason, at a certain point, the translation succeed, at least, from my experience |
Yes, issue is not solved, the program goes to infinite loop. |
I don't think we can rely on this library for production use. Any other free alternative? |
It works like a charm for me https://github.com/lushan88a/google_trans_new |
Thank you for sharing this resource, I confirm it works without problems so far. |
Be careful this is not Google Translate the output is much lower quality to what you get at https://translate.google.com/ There is a working solution for AHK (https://www.autohotkey.com/boards/viewtopic.php?t=63835). Why can't we make it work in Python? |
Hello |
Hi !! the same problem. |
My script like this:
#-- coding:utf-8 --
from googletrans import Translator
import sys
import io
translator = Translator()
tanstext = u'我们'
tran_ch = translator.translate(tanstext ).text
print tran_ch
###############
yesterday this is ok and no problem,but today I run my script without internet, show some problem.And I run the script in the internet environment, but it's show same problem,can't run.
The cmd show the Traceback like this:
Traceback (most recent call last):
File "D:\JDstory\workstory\translation-project\filetocut\trans-test.py", line
10, in
tran_ch = translator.translate(tanstext).text
File "D:\software\Python27\lib\site-packages\googletrans\client.py", line 132,
in translate
data = self._translate(text, dest, src)
File "D:\software\Python27\lib\site-packages\googletrans\client.py", line 57,
in _translate
token = self.token_acquirer.do(text)
File "D:\software\Python27\lib\site-packages\googletrans\gtoken.py", line 180,
in do
self._update()
File "D:\software\Python27\lib\site-packages\googletrans\gtoken.py", line 59,
in _update
code = unicode(self.RE_TKK.search(r.text).group(1)).replace('var ', '')
AttributeError: 'NoneType' object has no attribute 'group'
#########################
That's why? Thank you so much!
The text was updated successfully, but these errors were encountered: