Subprocess with real streaming to stdin / from stdout

15 views
Skip to first unread message

Gilles Lenfant

unread,
Mar 23, 2016, 2:08:18 PM3/23/16
to python-tulip
Hi,

I need to run in a subprocess a C app that reads binary data from stdin, filters and transforms these bytes to stdout (always as binary data.
The input and output streams mays be hundreds of megabytes (HF samples), thus I can't use the usual ".communicate()" method on such subprocess object, that will bloat my server memory.

Running this in shell is :

    cat hundreds_of_megs | my_filter > giant_filtered_data.bin

my_filter stops by itself when data from "hundreds_of_megs" are

I have to admit that I'm a noob in async design and somehow lost in the Python doc on asyncio.

(a) are asyncio resource the good answer to such problem ?

(b) can anyone point me to an example that really streams the data sent to stdin and retrieved from stdout.

Many thanks by advance
--
Gilles Lenfant

Reply all
Reply to author
Forward
0 new messages