fcntl/ioctl and O_NONBLOCK

Donn Cave donn at oz.net
Fri Nov 26 13:57:01 EST 1999


Quoth hildeb at www.stahl.bau.tu-bs.de (Ralf Hildebrandt):
... [stdout is Popen3.fromchild]

| rv = fcntl.ioctl(stdout.fileno(), FCNTL.O_NONBLOCK, 1)
| # rv = fcntl.ioctl(stdout.fileno(), FCNTL.O_NDELAY, 1)
| ... snap ...
|
| But no matter what I do - I keep getting
| IOError: [Errno 22] Invalid argument
|
| What I want to do: I want to use select() to see if there's data to be
| read from stdin or stdout and read it ALL (thus I need stdin/stdout to
| be non blocking!)

I don't know about the ioctl, but you may not need it after all if
you're already going to use select.  Select will tell you if the
I/O would block, if so then don't read.

(And you can't read from both ends, "stdin" (i.e., Popen3.tochild)
is opened for write and attempts to read from it will probably be
frustrating.)

	Donn Cave, donn at oz.net




More information about the Python-list mailing list