pythonpython-2.7text-to-speechespeak

Espeak on windows 7 and python 2.7


On the begin I'll say that there is a similar post here: How to use espeak with python and I was using answers from this post, but still i'm getting errors, so maybe u'll be able to help me fix it.

import subprocess
text = '"Hello world"'
subprocess.call('espeak '+text, shell=True)

This code gives me an error:

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

ps. I think I installed espeak correctly, because I can use in CMD line:

espeak "text"

and it will say "text" correctly.

PS2. probably answer for this question will be the answer for my another question I posted earlier. (How to save the output of PyTTSx to wav file)


Solution

  • import subprocess
    subprocess.call(['ping', '127.0.0.1'], shell=True)