RapidWareTech / pyttsx

Cross-platform text-to-speech wrapper
Other
370 stars 134 forks source link

Segfault on Ubuntu 10.10, 11.04 #3

Closed mrmekon closed 11 years ago

mrmekon commented 13 years ago

Situation:

import pyttsx pyttsx.init() Segmentation fault

Cause: In pyttsx/drivers/espeak.py, in init(), self.getProperty('voice') results in a call to GetCurrentVoice() in _espeak.py, which calls espeak_GetCurrentVoice() in libespeak.so.1. libespeak is returning a valid result with an empty name. EspeakDriver._defaultVoice gets set to None. A subsequent call to self.setProperty() references the None value, and causes a segmentation fault.

Possible solution: I know nothing of espeak or its API. Mine works, but does not return a 'current voice'. This solved the problem on my machine:

Replace line 37 of espeak.py:

EspeakDriver._defaultVoice = self.getProperty('voice')

With this block:

EspeakDriver._defaultVoice = self.getProperty('voice')
if EspeakDriver._defaultVoice == None:
    EspeakDriver._defaultVoice = "en"

This just defaults to english if espeak doesn't return a voice. Text-to-speech works as expected after this modification.

Version information: Ubuntu Server 10.10 Python 2.7 pyttsx-1.0 libespeak1 version 1.44.05~really-1.44.04-0ubuntu1

rodrigob commented 13 years ago

Same problem in Ubuntu 11.04. Would be nice the have this patched and feed into pypi

parente commented 13 years ago

Forgot this was open. Will merge fix soon.

rodrigob commented 13 years ago

the posted fix did not work on my Ubuntu 11.04

parente commented 13 years ago

@rodrigob the fix I just committed seems to get pyttsx working for me on Natty. Let me know if it works for you.

I do get a large batch of ALSA/Jack errors when espeak initializes, but it happens whether I'm using pyttsx or the espeak command line program directly. I think it's a consequence of running in VMWare Fusion.

rodrigob commented 13 years ago

the test now runs fine on my Natty machine. Thanks for the fix !

pyttsx_git/tests/manual$ python run.py
brousch commented 12 years ago

Can you upload this fixed version to PyPi?

juanantoniofm commented 12 years ago

Same problem on debian 6. espeak = version 1.46

parente commented 11 years ago

v1.1 with this fix pushed to pypi (finally).

marcobaturan commented 8 years ago

Hi! I try use a module Chatterbot mixed with Pyttsx for do it speak the chaterbot, but the loop While cut de pronunciation of word chains, example: chatbot write: hello, computer only say "he". The example block code is:

# chatbot empiieza' while True: speak = raw_input('- ') response = chatbot.get_response(speak) # dice la respuesta print response engine.say(response) # mantiene el TTS enn marcha engine.runAndWait()`