3

I have a simple Python script that uses pyttsx3:

import pyttsx3 as tts

engine = tts.init()
voices = engine.getProperty('voices')
engine.setProperty("voice", voices[1].id)
engine.say("Hello")
engine.runAndWait()

However when I run it, the program immediately ends with this error: Process finished with exit code 139 (interrupted by signal 11: SIGSEGV) And my MacBook tells me that Python quit unexpectedly.

I'm using PyCharm 2022.2.2 (Community Edition).

I've checked online but none of the solutions worked for me. The line causing the problem seems to be engine = tts.init(). Please help me fix this problem. Thank you in advance.

nerdintown
  • 115
  • 1
  • 7

1 Answers1

1

I am using a Mackbook with OS Catalina and using pycharm and I encountered the same problem you are facing when trying to initialize an object from class tts.init(). I noticed that I had another code using the same library and that worked perfectly fine so I checked the libraries that the code was using and realize that it uses PyObjC which is a bridge between Python and Objective-C for macOS and allowing Python use some of the tool kits of Object C . I downgraded the version of PyObjC to 8.5 and voila it worked like a charm. It is not a PyCharmm problem but of this library. Try and change it and let us knowif this worked for you.

Okamiram
  • 43
  • 5