When is Popen.communicate () insufficient?

I found many threads, more or less related to this topic, and still almost nothing, as a complete answer ... I am looking for your advice on this.

So, here is my problem: I really need to communicate with the subprocess in both directions: I have to pull a lot of data to my input and get its output on the fly. There is no such thing. My subprocess is the famous "chrome" mp3 encoder, the input signal of which is an hour or longer PCM sound generated by my function, and the output is an mp3 file, which should also be sent to the user to a piece, without waiting for the encoding to finish.

According to the docs, Popen.communicate () will not help me handle IPC measured in tens or hundreds of megabytes. At the same time, as I learned from here, it is very dangerous to try to create this approach from scratch, as many traps await: deadlocks, buffering, process control, etc.

So my question is: is there some well-known solution for this kind of problem: python lib or sample code that really solves the problem? Maybe at least there is an article or something that clearly describes most of the problems that you may encounter in trying to solve it yourself?

Thanks in advance, Ilya.

+5
source share
1 answer

- : , LAME, , . , .

, , IPC. . - Python 3 .

+2

All Articles