python - Converting binary output from external program to variable in realtime -
i outputting
parec -d "name" you don't need know command, know press enter, outputs binary data representing audio.
my goal read python in real time, ie start , have in variable "data" can read
data = p.stdout.read() what tried
p = subprocess.popen(['parec','-d','"name"'],stdout=subprocess.pipe,shell=true) while true: data = p.stdout.read() but results in no data being received.
parec -d "name" > result.raw is readable audio-programme , contains necessary data. command python?
when call read() on subprocess.pipe believe block until parec exits
im pretty sure solution should not block :)
found solution
from subprocess import popen, pipe, stdout p = popen('c:/python26/python printingtest.py', stdout = pipe, stderr = pipe) line in iter(p.stdout.readline, ''): print line p.stdout.close() it took alot of searching solution can found @ getting realtime output using subprocess
Comments
Post a Comment