Line buffering pipes
sjackman at gmail.com
Sat Oct 30 01:10:34 CEST 2004
I'm reading from a tcpdump pipe. I want to receive one line from the
pipe as soon as its available from tcpdump. Something is buffering the
pipe though, so I am receiving nothing, then multiple lines in a big
batch. I thought this was the inherent buffering of next(), but it
affects readline too.
tcpdump = os.popen( 'sudo tcpdump', 'r')
while True: print tcpdump.next(),
while True: print tcpdump.readline(),
buffer mutiple lines before printing.
Please cc me in your reply. Thanks,
More information about the Python-list