Token: regexp never finds anything
See original GitHub issueHello,
I know the code yielding this error is not in this repository but the gtts-token repository seems inactive…
Since a few hours ago it seems that one of the regular expressions when searching “TKK=‘integer.integer’;” in Google Translate HTTP response doesn’t find anything.
Here is my Traceback:
gtts-cli 'hello' --output hello.mp3
Traceback (most recent call last):
File "/usr/local/bin/gtts-cli", line 9, in <module>
load_entry_point('gTTS==2.0.1', 'console_scripts', 'gtts-cli')()
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/gtts/cli.py", line 194, in tts_cli
tts.write_to_fp(output)
File "/usr/local/lib/python2.7/dist-packages/gtts/tts.py", line 187, in write_to_fp
part_tk = self.token.calculate_token(part)
File "/usr/local/lib/python2.7/dist-packages/gtts_token/gtts_token.py", line 28, in calculate_token
seed = self._get_token_key()
File "/usr/local/lib/python2.7/dist-packages/gtts_token/gtts_token.py", line 62, in _get_token_key
a = re.search("a\\\\x3d(-?\d+);", tkk_expr).group(1)
AttributeError: 'NoneType' object has no attribute 'group'
Is it possible this is caused by a modification in Google Translate HTTP response? I tried with other google translate python apps and they also fail to find the token…
Best regards, Thomas
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:32 (6 by maintainers)
Top Results From Across the Web
Regular expression : Match anything but full token
If your regex flavor did not support non-greedy matching, the following would do it, ... Depending on your regex favour, negative zero-width look-ahead...
Read more >Lookahead and Lookbehind Zero-Length Assertions
The regex q(?=u)i can never match anything. It tries to match u and i at the same position. If there is a u...
Read more >Everything you need to know about Regular Expressions
After reading this article you will have a solid understanding of what regular expressions are, what they can do, and what they can't...
Read more >Regex Quantifier Tutorial: Greedy, Lazy, Possessive - RexEgg
A regex quantifier such as + tells the regex engine to match a certain quantity of the character, token or subexpression immediately to...
Read more >Regular Expressions: Regexes in Python (Part 1)
This contains some useful information. span=(3, 6) indicates the portion of <string> in which the match was found. This means the same thing...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
gTTS-token 1.1.2 has just been released. Thanks a lot for the work everyone. It’s good to see something I’ve created years ago still being cared about.
That’s hard to say as this exception is the result of a faulty regex handler in another repo (for which I’ve submitted a pull request for) that is rather inactive as of now.
However, in the meantime you can monkey-patch the affected function like so:
I hope that helps.