-
Notifications
You must be signed in to change notification settings - Fork 361
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
ValueError: Unable to find token seed! Did https://translate.google.com change? #232
Comments
I started getting this last week periodically. It happened about 10 times to me today. I have no clue. |
The error is not continuous, it happens randomly from what I can tell. For me it's definitely within 10-15 requests. Since I observed that it doesn't happen continuously, I just wrote a import os
from gtts import gTTS
text = 'Your sentence requiring text to speech'
file_path = 'text.mp3'
while not os.path.exists(file_path) or os.path.getsize(file_path) == 0:
try:
tts = gTTS(text=text, lang='en', slow=False)
tts.save(file_path)
except Exception as e:
print(e.message) Obviously, this is a very bad solution and I would never recommend it. But it does the job for now as a temporary fix until this issue gets permanently resolved. |
That's interesting. Mine was breaking on the tts.save line, so this wasn't working for me. This is how I got it working...
I have the count in there just out of curiosity, obviously you don't need that. I just tried this for about 20 minutes and got the error maybe 20% of the time. Only once did the count get to 2. Seems to be working without crashing now. |
Happening with me also, using Python 3.9 on Windows 10. The error:
EDIT: after some analysis, seems to be crashing on the |
Yes it's crashing at the save. Take a look at the fix I presented above. It will keep the code working. Just use a while loop and put the "try" call on the save with a break after. For the except, you can put anything in there. I just liked to see an error message but it's completely optional. This is obviously not ideal but the code is working fine on my end after implementing the while loop. |
Hi @thedaynos , thanks for the help. I will make that "fix". |
no problem @afonsosantos ... I'm using 3.6 on ubuntu. I updated all of the libraries/packages that I'm using as well. |
@afonsosantos I am using Python @thedaynos You are right, the error isn't that often. For me, the max number of continuous failed attempts were 3 and it is occurring on the line |
found a guy saying to add client=tw-ob in the url ( can´t be sure why, and if it works 100% of the time)
EDIT: BTW, you can use this url to download, so you don´t even need this repo |
I can make a PR with that change and see if that improves anything. |
I found the post,
Seems like adding |
I'm also stuck in this bug. |
@badjano seems like using that link too much gets you locked. I will for alternative services until this issue is fixed. |
@afonsosantos What is "too much"? Google Translate TTS in general has a limit of 2M characters per day. |
@Fabian42 as @Mohammed-Shoaib stated:
I don't want the risk of being blocked by using that parameter, and If that does not work either, I will find alternatives. |
@afonsosantos You don't really need to find or use alternatives though. As mentioned by @thedaynos in his comment, you could use the same trick temporarily for now until this gets fixed. I am sure the developers will eventually fix this soon, let's be patient. |
@Mohammed-Shoaib I will, but I need alternartives in case the issue does not get fixed soon. I don't want to put pressure on the projects devs. |
i have same problem |
I have the same problem, at first was intermittent now all the time. @alexrink96 has posted a good workaround here using the requests library >> (#226 (comment)) that uses a different way to access the api and it is working for me at the moment. |
That looks like a good alternative, even to this library itself. Will test that and report the results. |
Multiple users in the mycroft chat including me also reported this error. I'll check if I can test the workaround. |
The underlyting gtts-token library was just updated with this change: Boudewijn26/gTTS-token@8d68185 and it was released already. However, this still doesn't fix the actual problem but instead just hides it in the background. (Retry 5 times or throw error) |
Yeah, this is starting to get tough to maintain/counter. It's a pretty unorthodox usage of this translate endpoint after all.. But will pull in the updated gtts-token and other fixes and do a release later today. |
This is the URL this library uses. Over the years, I've had to change the However, looking at network traffic when using the newer https://translate.google.com, it's pretty obvious that Google has switched to another way of generating speech. It doesn't hit Considering how many libraries use I enjoy a good challenge of trying to find a way to make this work reliability again, but as I was saying, this will become more and more difficult—perhaps impossible. |
It updates I've also reworked the GitHub Action workflows and "marked" with PyTest the tests that try to access the |
To add to this discussion: I, as maintainer of gTTS-token, also intent to look into this further in order to, if possible, ensure compatibility with the new changes Google is rolling out. This has been complicated by the simple fact I haven't received the new Google Translate yet. It's not at all uncommon for larger corporations to roll out changes gradually and that indeed appears to be happening here. We don't have any insight into which regions get this new "feature" first, so we'll just have to wait for now. That being said, this is an undocumented API, so we really can't blame Google for changing this without notice. For what I gather Google has turned a blind eye towards this whole thing. It wouldn't be too difficult for them to obfuscate the API to such an amount it'd be tremendously difficult to reverse engineer, which is something they haven't done (yet?) in the many years these projects exist. As stated, should this problem persist, everyone is free to comment on Boudewijn26/gTTS-token#20 or raise a new issue there (or continue the discussion here, I suppose). |
@pndurette Your lib uses the I'm not quite sure on how I'd tackle the update on HA side, I'll give them a ping in their discord and let them decide. I hope someone of them will reply here :). |
|
Seems like the old solution in HA finally broke completely now.... :( |
@hmmbob Ah yeah that was imminent. Sadly did not have any time to work on the above to make gTTS more HA-friendly. 😭 |
Just checked with one of the core devs (Frenck): there is no need for you to redo your package to use Wish I could be of help, but I don't have the programming experience to build this myself.... |
@hmmbob Could you properly test it if I do it? |
I'd say yes (it basically involves installing it as custom_component, I guess?) Have a few people around me that could test too. |
I'd create a feature branch - you'd basically have to check it out and run HA from there and then test google_translate. |
That's ok. Maybe we should switch to your issue at HA for this effort? |
Yes, now is completely broken... I couldn't use the API since yesterday. |
This is the error I get before I add the new gTTS master (that is, with the gtts file and the gtts_token): Error Caught exception: However, this is what I get when I add the new gTTS master one and delete the other two files: Caught exception: Please help and explain in simple dumb terms, as I am not a coder in any way, shape or form but a simple man just trying to use anki to learn Chinese. Please help thank you |
Please forgive my ignorance. I am getting this error when using the below card:
However, I am still able to make the same device talk successfully by using below:
I'm curious why does one work, but not the other? They are both making my Google Nest speak. Will I be able to use the card that's failing now in an upcoming Home Assistant version without changing anything in my configuration? |
Just closing this, as it was kept for discussion after the issue was fixed and then bit of an HA direction talk but it's starting to derail a bit. So cool to see this go to HA, thanks for your work all. I'll sure try to contribute when I can! |
Has the Error been fixed? Should I just upgrade gTTS ans gTTS-token? |
Upgrading the versions worked for me. |
Uninstall and Reinstall of gTTS worked For me. |
bro the same is happening with me tooo |
tried uninstalling and installing but still the same error. |
Uninstall and Reinstalling it Helped Me |
After I send 10-15 requests, I get the following error:
I thought this might be a bug in the latest release, i.e., 2.1.1 so I tried 1.2.0 and I still get the same error.
I also thought it could be that my IP address is being blocked. I read up on the Quotas & limits and I don't think that should be an issue as well.
System information:
Thank you for your timely help.☺️ ✨
The text was updated successfully, but these errors were encountered: