kalliope-project / kalliope

Kalliope is a framework that will help you to create your own personal assistant.
https://kalliope-project.github.io/
GNU General Public License v3.0
1.71k stars 230 forks source link

Problem when changing The TTS !! (googletts) #531

Closed Amrlol closed 5 years ago

Amrlol commented 5 years ago

hey guys so i'm trying to change the TTS from pico2wave to googletts . i've read in the docs that i can change it by changing the default so i did , but i keep getting an error

"AttributeError: 'NoneType' object has no attribute 'group'"

here is my tts settings !!


 ---------------------------
 Text to speech
 ---------------------------
 This is the default TTS that will be used by Kalliope to talk.
default_text_to_speech: "googletts"
 where we store generated audio files from TTS engine to reuse them
cache_path: "/tmp/kalliope_tts_cache"

Text to Spreech engines configuration
Available engine are:
- pico2wave
 - watson
- pico2wave
 - googletts
 - voicerss
text_to_speech:

  - pico2wave:
      language: "en-US"
      cache: True
  - googletts:
      language: "en"
      cache: True
  - voicerss:
      language: "en-us"
      cache: True

and here is my error !!

 Debug mode: on
WARNING:gtts.tts:Unable to get language list: 'NoneType' object has no attribute '__getitem__'
Exception in thread <class 'kalliope.signals.order.order.Order'>:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/local/lib/python2.7/dist-packages/kalliope-0.5.2-py2.7.egg/kalliope/signals/order/order.py", line 86, in run
    HookManager.on_start()
  File "/usr/local/lib/python2.7/dist-packages/kalliope-0.5.2-py2.7.egg/kalliope/core/HookManager.py", line 15, in on_start
    return cls.execute_synapses_in_hook_name("on_start")
  File "/usr/local/lib/python2.7/dist-packages/kalliope-0.5.2-py2.7.egg/kalliope/core/HookManager.py", line 100, in execute_synapses_in_hook_name
    return SynapseLauncher.start_synapse_by_list_name(list_synapse, new_lifo=True)
  File "/usr/local/lib/python2.7/dist-packages/kalliope-0.5.2-py2.7.egg/kalliope/core/SynapseLauncher.py", line 70, in start_synapse_by_list_name
    return lifo_buffer.execute(is_api_call=True)
  File "/usr/local/lib/python2.7/dist-packages/kalliope-0.5.2-py2.7.egg/kalliope/core/Lifo/LIFOBuffer.py", line 109, in execute
    self._process_synapse_list(last_synapse_fifo_list)
  File "/usr/local/lib/python2.7/dist-packages/kalliope-0.5.2-py2.7.egg/kalliope/core/Lifo/LIFOBuffer.py", line 139, in _process_synapse_list
    self._process_neuron_list(matched_synapse=matched_synapse)
  File "/usr/local/lib/python2.7/dist-packages/kalliope-0.5.2-py2.7.egg/kalliope/core/Lifo/LIFOBuffer.py", line 173, in _process_neuron_list
    parameters_dict=matched_synapse.parameters)
  File "/usr/local/lib/python2.7/dist-packages/kalliope-0.5.2-py2.7.egg/kalliope/core/NeuronLauncher.py", line 62, in start_neuron
    instantiated_neuron = NeuronLauncher.launch_neuron(neuron)
  File "/usr/local/lib/python2.7/dist-packages/kalliope-0.5.2-py2.7.egg/kalliope/core/NeuronLauncher.py", line 44, in launch_neuron
    resources_dir=neuron_folder)
  File "/usr/local/lib/python2.7/dist-packages/kalliope-0.5.2-py2.7.egg/kalliope/core/Utils/Utils.py", line 140, in get_dynamic_class_instantiation
    return klass(**parameters)
  File "/usr/local/lib/python2.7/dist-packages/kalliope-0.5.2-py2.7.egg/kalliope/neurons/say/say.py", line 11, in __init__
    self.say(self.message)
  File "/usr/local/lib/python2.7/dist-packages/kalliope-0.5.2-py2.7.egg/kalliope/core/NeuronModule.py", line 174, in say
    tts_module_instance.say(tts_message)
  File "/usr/local/lib/python2.7/dist-packages/kalliope-0.5.2-py2.7.egg/kalliope/tts/googletts/googletts.py", line 26, in say
    self.generate_and_play(words, self._generate_audio_file)
  File "/usr/local/lib/python2.7/dist-packages/kalliope-0.5.2-py2.7.egg/kalliope/core/TTS/TTSModule.py", line 106, in generate_and_play
    generate_audio_function_from_child()
  File "/usr/local/lib/python2.7/dist-packages/kalliope-0.5.2-py2.7.egg/kalliope/tts/googletts/googletts.py", line 53, in _generate_audio_file
    tts.save(self.file_path)
  File "/usr/local/lib/python2.7/dist-packages/gTTS-2.0.1-py2.7.egg/gtts/tts.py", line 247, in save
    self.write_to_fp(f)
  File "/usr/local/lib/python2.7/dist-packages/gTTS-2.0.1-py2.7.egg/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'

can anybody tell what would the problem be ??? @Sispheor !

corus87 commented 5 years ago

Hi, there was a problem with the gtts package but got fixed a while ago. Try updating the packages.

sudo pip install gTTS -U sudo pip install gTTS-token -U

Amrlol commented 5 years ago

i've tried to update the packages .. but the voice has some issues and dont pronunce the full sentence ,, after couple of tries this warning showed up !!

WARNING:gtts.tts:Unable to get language list: 'NoneType' object has no attribute 'getitem'

@corus87

corus87 commented 5 years ago

So the first problem is fixed? About the other problem, I don't know, if its doesn't get pronounce right, I assume its a problem with google not with the package. Also I can't find anything about this warning. What language you want to use?

Amrlol commented 5 years ago

the first problem is fixed , which is google tts is speaking .. the second problem is not pronouncing right or it doesn't prononce the full sentence !!

i'm using the "En" language !! @corus87

corus87 commented 5 years ago

Hmm that's weird in German the pronounces are mostly good, but I guess its a problem with google itself. You can try to put your sentence in here https://translate.google.com and look how the pronounces are there. Because the package take use of the google translator tts. So it should be the same.

Amrlol commented 5 years ago

i've tried a lot of things but it seems to have the same problem with pronounciatio , it doesn;t say the whole sentence :/ .

Sispheor commented 5 years ago

Google TTS is currently down on kalliope. We'll fix ASAP. For more info:

We need to update the lib once the fix has been back ported

corus87 commented 5 years ago

Its working on my side, I just updated the package yesterday. Also gtts-token gets updated. So the problem should be fixed.

Sispheor commented 5 years ago

I don't find what package is actually installing gTTS-token.

pipdeptree --reverse --packages gTTS-token

This return nothing.

Anyway, a fresh install of kalliope is not affected by the issue as the lib has been updated. Old install have to update with

sudo pip install --upgrade gTTS-token

I think we can close the issue.

Amrlol commented 5 years ago

after uninstalling gtts and gtts-token , and reintalling them again , i get this error WARNING:gtts.tts:Unable to get language list: 'NoneType' object has no attribute '__getitem__