precise_runner is blocking on line proc.stdout.readline()
Hello,
I can't get working binary engine with precise_runner on Ubuntu 18.04 with python 3.6.9
The engine itself works fine and gives a correct output with command line
./precise-engine/precise-engine ./hey-mycroft.pb 4096 <hey-mycroft.wav
but when run with precise_runner it's blocking in method get_prediction of PreciseEngine class in the last line
return float(self.proc.stdout.readline())
looks like the output of engine is buffered and not flushed running python3 unbuffered (with -u) doesn't helps (program ends immediately)
I think the solution would be flushing output of precise-engine after writing each line
Hmm, not sure because precise-engine already flushes stdout here.
I simulated the engine with this simple code
import sys import random
while True: chunk = sys.stdin.buffer.read(2048) sys.stdout.write("{}\n".format(random.random())) #sys.stdout.flush()
when run with sys.stdout.flush() commented out the runner blocks as described before but with sys.stdout.flush() uncommented it works fine
maybe using stdout.buffer.write in precise-engine is the issue ?