I need to read stream from FD 3(STDERR) in Python.
In perl I would do this:
# Open the audio file descriptor
$audio_fh->fdopen( 3, "r" );
$bytes_read = $audio_fh->read($buffer, 80000)
How do I do the same in Python?
Use os.fdopen to get a file object for a file descriptor.
import os
audio_fh = os.fdopen(3)
buffer = audio_fh.read(80000)
You can also read directly from the file descriptor with
buffer = os.read(3, 80000)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With