Connecting Tech Pros Worldwide Help | Site Map

Re: Reading from stdin

Hendrik van Rooyen
Guest
 
Posts: n/a
#1: Oct 9 '08
Luis Zarrabeitia wrote:
Quote:
>But it doesn't say how to put the file object in non-blocking mode. (I was
>trying to put the file object in non-blocking mode to test next()'s
>behavior). ??Ideas?
# Some magic to make a file non blocking - from the internet

def unblock(f):
"""Given file 'f', sets its unblock flag to true."""

fcntl.fcntl(f.fileno(), fcntl.F_SETFL, os.O_NONBLOCK)

- Hendrik


Closed Thread