Kevin Walzer wrote:

I'm also skeptical of the value of subprocess, at least as a complete replacement for os.popen (the original version): it currently provides no way to set a 'non-blocking' mode. I make heavy use of this kind of call in my code:

self.file = os.popen('do stuff here'), 'r', os.O_NONBLOCK)

Eh, what? The third argument to os.popen is the buffer size to use for the file object, while O_NONBLOCK is an integer flag that you can use with os.open (no "p" in there), fcntl, etc. to work with fifos and special devices.

(O_NONBLOCK happens to be 2048 on at least some Unix machines, so chances are that your snippet simply opens the stream with a 2k buffer instead of the 4k default.)

To control the buffer size for subprocess, use the bufsize argument to Popen.

</F>

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to