Mark.B
Mark.B

Reputation: 31

Using Espeak with os in python

When I open up my command prompt, i am able to type espeak and then the text i want to be said, however when i try to do this through my python code using os it says

'espeak' is not recognized as an internal or external command, operable program or batch file.

import os
text = "Apples"
os.system('espeak "{}"'.format(text))

I've tinkered with the code a fair amount but there is not much to tinker

Upvotes: 0

Views: 496

Answers (1)

gelonida
gelonida

Reputation: 5630

try /usr/bin/espeak instead of espeak. That works for my machine.

In order to be sure it works for your host I suggest you open a console and type

type espeak

This will output the absolute path of espeak. Copy that one into your system command

Upvotes: 1

Related Questions