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

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -