0

I'm using subprocess to run a command line tool. This tool is computing and printing in the console an offset value i need to get. But both stdout and stderr are empty. This is my python code :

import subprocess

PRAAT_EXE = r'S:\Resources\SOFTWARE_AND_UTILITIES\Praat\Praat.exe'
WAV_FILE_1 = r'F:\dev\praat\one.wav'
WAV_FILE_2 = r'F:\dev\praat\two.wav'
CMD = '{0} crosscorelate.praat {1} {2}'.format(PRAAT_EXE, WAV_FILE_1, WAV_FILE_2).split()

p = subprocess.Popen(CMD, shell=True)
output, err = p.communicate()
print("OUTPUT", output)
print("ERRORS", err)

And this is the output of the console :

F:\dev\praat>python test_praat.py
-0.09053774572864626
OUTPUT None
ERRORS None

So you see the value is printed in the console before the python script continues. I don't know in which pipe this value goes but i can't get it.

EDIT : The following prints nothing in the file :

Praat.exe crosscorelate.praat one.wav two.wav > result.txt

But a couple seconds after the python script finished, the value is printed in my command prompt like this :

F:\dev\praat>-0.09053774572864626
Narthe
  • 492
  • 1
  • 4
  • 16
  • A quick look at praat's documentation indicates that you must add a `--run` argument to get it to work reliably from a command line with redirection. – jasonharper Aug 29 '18 at 20:23
  • I think this argument is optional since it doesn't fix my issue abd the script runs the same way – Narthe Aug 29 '18 at 21:28

0 Answers0