Has anyone successfully used pyttsx3 module in their Anvil app?
I tried doing a simple test from their examples page after installing the pyttsx3 module, however I get an error:
OSError: libespeak.so.1: cannot open shared object file: No such file or directory
My code (in server module):
import pyttsx3
engine = pyttsx3.init()
engine.say("I will speak this text")
engine.runAndWait()
It seems “espeak” is a dependency of this library? I tried adding “espeak” package to the app, however the closest thing available was “espeakng”. Unfortunately the error did not get resolved.
What you are doing here will only be able to play the speech on server side. Instead, you will have to save the output as a audio file and then return it on client side.
There is a similar example that uses gtts instead of pyttsx3