ras ku
ras ku

Reputation: 33

How to solve ValueError: Unable to find token seed! Did https://translate.google.com change?

I am building a voice assistance using gtts as text to speech and speech recognition. but i got the error in the line where i want to save the bot input.

The error infomation is given below:

Traceback (most recent call last):
File "d:\rasa test\voice_bot.py", line 64, in <module>
myobj.save(filename)
File "D:\Anaconda\lib\site-packages\gtts\tts.py", line 295, in save
prepared_requests = self._prepare_requests()
File "D:\Anaconda\lib\site-packages\gtts\tts.py", line 194, in _prepare_requests
part_tk = self.token.calculate_token(part)
File "D:\Anaconda\lib\site-packages\gtts_token\gtts_token.py", line 28, in calculate_token
seed = self._get_token_key()
File "D:\Anaconda\lib\site-packages\gtts_token\gtts_token.py", line 58, in _get_token_key
raise ValueError(
ValueError: Unable to find token seed! Did https://translate.google.com change?

Is this is a problem with gtts or something else,can anyone explain?

Upvotes: 0

Views: 2499

Answers (2)

MisterSeajay
MisterSeajay

Reputation: 4659

1 Upgrade gTTS-token

Had the same problem today. I checked my packages and saw that gtts and gtts-token were out of date:

>>> python -m pip list --outdated

----------------- --------- --------- -----
gTTS              2.1.1     2.2.1     wheel
gTTS-token        1.1.3     1.1.4     sdist

I updated both:

python -m pip install --upgrade gtts
python -m pip install --upgrade gtts-token

This appears to have solved the problem for me.


2 Implement retry logic

This error is mentioned in the issue tracker on the gTTS-token git repo. The comments don't give much more information other than a mention of a "retry mechanism" which sounds like a workaround if/when the library encounters this error.

Now that I am using gTTS v1.1.4 I have noticed that it sometimes seems to take longer to access Google Translate from my application. I guess this is the library's internal retry cycle at work.

So, if you're not able to upgrade gTTS-token then you might have to catch this error and implement your own retry logic.

Upvotes: 6

alghamdi
alghamdi

Reputation: 1

this is because gTTS
you are not using gTTS v1.1.4

https://github.com/Boudewijn26/gTTS-token/releases/tag/v1.1.4 check this and it should work with you

Upvotes: -1

Related Questions