shinjimatsumoto / google_home_speech

Let Google Home speak voice message.
MIT License
2 stars 0 forks source link

AttributeError: 'NoneType' object has no attribute 'group' #1

Open shinjimatsumoto opened 6 years ago

shinjimatsumoto commented 6 years ago

Since 19 Sep 2018, google_home_speech fails with AttributeError in my environment.

127.0.0.1 - - [27/Sep/2018 06:45:35] "GET / HTTP/1.1" 404 -
Host: localhost:8000
User-Agent: curl/7.52.1
Accept: */*
Content-Length: 26
Content-Type: application/x-www-form-urlencoded

POST requestBody={"text":"こんにちは"}
**JSON**
{
    "text":"\u3053\u3093\u306b\u3061\u306f"
}
get speech data for こんにちは(ja)
Traceback (most recent call last):
  File "/usr/lib/python3.5/socketserver.py", line 313, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python3.5/socketserver.py", line 341, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python3.5/socketserver.py", line 354, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.5/socketserver.py", line 681, in __init__
    self.handle()
  File "/usr/lib/python3.5/http/server.py", line 422, in handle
    self.handle_one_request()
  File "/usr/lib/python3.5/http/server.py", line 410, in handle_one_request
    method()
  File "./google_home_speech.py", line 105, in do_POST
    do_speech(text, language)
  File "./google_home_speech.py", line 66, in do_speech
    tts.save(speech_filename)
  File "/home/pi/.local/lib/python3.5/site-packages/gtts/tts.py", line 247, in save
    self.write_to_fp(f)
  File "/home/pi/.local/lib/python3.5/site-packages/gtts/tts.py", line 187, in write_to_fp
    part_tk = self.token.calculate_token(part)
  File "/home/pi/.local/lib/python3.5/site-packages/gtts_token/gtts_token.py", line 28, in calculate_token
    seed = self._get_token_key()
  File "/home/pi/.local/lib/python3.5/site-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'
shinjimatsumoto commented 6 years ago

This seems related with these issues.

https://github.com/pndurette/gTTS/issues/138 https://github.com/pndurette/gTTS/issues/60

shinjimatsumoto commented 6 years ago

To fix this problem, try upgrading gTTS-token.

pip3 install gTTS-token --upgrade