question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Token unavailable again? AttributeError: 'NoneType' object has no attribute 'group'

See original GitHub issue

Today when I run simple test :
(gTTS==1.2.1 gTTS-token==1.1.2)

tts = gTTS('Hello',  lang='en')
tts.save('hello.mp3')

It shows me

lib/python2.7/site-packages/gtts_token/gtts_token.py", line 57, in _get_token_key
    tkk_expr = re.search(".*?(TKK=.*?;)W.*?", line).group(1)
AttributeError: 'NoneType' object has no attribute 'group'

Is token changed again?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

13reactions
pGoNpcommented, Nov 29, 2018

Ugly workaround:

Open /usr/local/lib/python2.7/dist-packages/gtts_token/gtts_token.py

And replace _get_token_key function with:

    def _get_token_key(self):
        if self.token_key is not None:
            return self.token_key

        response = requests.get("https://translate.google.com/")
        result = re.search("tkk:'(\d+\.\d+)", response.text).group(1)

        self.token_key = result
        return result
2reactions
Boudewijn26commented, Nov 30, 2018

This should be fixed in gTTS-token 1.1.3. Please update and verify

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python regex AttributeError: 'NoneType' object has no attribute ...
I managed to figure out this solution: omit group() for the situation where the searchbox reply is "No results" and thus doesn't match...
Read more >
AttributeError: 'NoneType' object has no attribute 'group'
The Python "AttributeError: 'NoneType' object has no attribute" occurs when we try to call the group() method on a None value, e.g. after ......
Read more >
[Solved] AttributeError: Nonetype Object Has No Attribute Group
In this article we will discuss AttributeError:Nonetype object has no Attribute Group. We will understand it and then find solution for it.
Read more >
Python AttributeError — What is it and how do you fix it?
AttributeError : '***' object has no attribute '***'What is an AttributeError in Python ? What can you do to fix it? When does...
Read more >
AttributeError: 'NoneType' object has no attribute 'group' - Reddit
So you're either running an older version, or you unconsciously corrected the mistake while copying the code to your post.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found