1

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)

Community
  • 1
  • 1
degath
  • 1,530
  • 4
  • 31
  • 60
  • Are you sure you can run `espeak` from the command line, in the same terminal you call your python script? – Chris_Rands Aug 18 '16 at 12:18
  • Oh, now I get it. I'm using espeak "say" on my CMD console in windows (start->cmd) and there works correctly. But when I use python terminal in my pyCharm it gives me an 'espeak' is not recognized as an internal or external command, operable program or batch file error. Any idea how to solve my problem? – degath Aug 18 '16 at 12:22
  • Try adding the full path to your `espeak` installation – Chris_Rands Aug 18 '16 at 12:25
  • worked out, thanks :-) – degath Aug 18 '16 at 13:49

1 Answers1

1
import subprocess
subprocess.call(['ping', '127.0.0.1'], shell=True)
vadim vaduxa
  • 221
  • 6
  • 16
  • with just: `import subprocess text = "something" subprocess.call(['espeak', text], shell=True)` it still gives me an 'espeak' is not recognized as an internal or external command, operable program or batch file. like I writed on the begin of my post – degath Aug 18 '16 at 12:15
  • try 'c:\\espeak.bat' – vadim vaduxa Aug 18 '16 at 12:21
  • dont know what you mean. u want me to put this in console or what? – degath Aug 18 '16 at 12:39
  • Pinging 127.0.0.1 with 32 bytes of data: Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Ping statistics for 127.0.0.1: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms it seems ping work normally. – degath Aug 18 '16 at 12:49
  • subprocess.call(['c:\\123\\espeak.exe', text], shell=True) – vadim vaduxa Aug 18 '16 at 13:02
  • Ok, it worked out, it readed what I wanted, I'm glad you helped me out and really thanks for help, but I'm now curious why my start->cmd doesn't work like python terminal... where is the difference? Maybe u know where I can find article which will explain me this, or maybe u can answer in few words? :-) – degath Aug 18 '16 at 13:14
  • 1
    ahh, Its problem with paths. I used os.chdir(os.path.join("C:\Program Files (x86)\eSpeak\command_line")) and it work now like it should :-) – degath Aug 18 '16 at 13:39