Changes by Philip Jenvey pjen...@underboss.org:
--
resolution: - invalid
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7240
___
Ronald Oussoren ronaldousso...@mac.com added the comment:
I don't think so. stdio on OSX has a fdiscard function, but that's not
exposed to Python.
I tend to explicitly synchronize on prompts when communicating with an
interactive program over a pipe. That is, read until you found the prompt,
Philip Jenvey pjen...@underboss.org added the comment:
Why are you flushing stdout? It's read-only and flush is for writing. This
behavior is dependent on the underlying platform's fflush, which really
*should* be raising EBADF when fflushing a read only file, anyway
--
nosy: +pjenvey
Ned Deily n...@acm.org added the comment:
Philip is correct:
p.stdout.flush()
Traceback (most recent call last):
File stdin, line 1, in module
IOError: [Errno 9] Bad file descriptor
p.stdout
open file 'fdopen', mode 'rb' at 0x100527470
You'll get the same error on OS X (at least as far
Peter Gibson peteh...@gmail.com added the comment:
Not my code, but as it's using a pipe to communicate with another
process, I assume that the flush call is intended to discard any
unwanted output prior to sending a command and processing the result.
Is there another way to achieve the same
New submission from Peter Gibson peteh...@gmail.com:
subprocess.Popen.stdout.flush() fails on OS-X 10.6.1 under the bundled
Python 2.6.1 and 2.6.3 from Macports.
from subprocess import Popen, PIPE
p = Popen('cat', stdin=PIPE, stdout=PIPE)
p.stdout.flush()
Traceback (most recent call last):