pythonlinuxubuntualsapyttsx3

Pyttsx3 Ubuntu aplay:main:831 Error audio open error


I've been trying forever to get my pyttsx code working. I am working in a Github codespace based on Linux Ubuntu. Since it is not my own I can't access any of its settings.

enter image description here

I've ran a number of different commands to try to get it to work, including:

sudo apt-get update
sudo apt install espeak
sudo apt-get install alsa-utils

as well as installed libspeak. The errors unfortunately still persist. Any ideas how to fix it or get around it and still get pyttsx to run?


Solution

  • Solved the issue by adding these lines to the top of the script:

    os.system('sudo apt install -y espeak')
    os.system('sudo apt-get -y update')
    os.system('sudo apt-get install -y alsa-utils')
    os.system('sudo apt-get install -y software-properties-common')
    os.system('sudo apt-get install -y ffmpeg')