[issue7240] subprocess.Popen.stdout.flush fails os OS-X 10.6.1

Ned Deily report at bugs.python.org
Fri Oct 30 07:26:14 CET 2009


Ned Deily <nad at 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 back as Python 2.3.5 
on OS X 10.4) if you try to flush a disk read-only file:

>>> f = open('a.txt', 'rb')
>>> f.flush()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
IOError: [Errno 9] Bad file descriptor

Note, both the OS X and Linux 2.6 fflush(3) man pages clearly state that 
EBADF can be returned if the stream is not open for writing but there 
seems to be a difference in behavior between the two OS's.

As this doesn't seem to be a new issue and can easily be avoided (don't 
flush a read-only file), I suggest closing the issue.

----------
assignee:  -> ronaldoussoren
components: +Macintosh
nosy: +ned.deily, ronaldoussoren

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7240>
_______________________________________


More information about the Python-bugs-list mailing list