Pyttsx3 Ubuntu aplay:main:831 Error audio open error

Question:

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?

Asked By: VinPy

||

Answers:

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')
Answered By: VinPy
Categories: questions Tags: , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.