This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ned.deily
Recipients ned.deily, petegibson, pjenvey, ronaldoussoren
Date 2009-10-30.06:26:11
SpamBayes Score 4.489742e-13
Marked as misclassified No
Message-id <1256883974.44.0.446612013588.issue7240@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2009-10-30 06:26:14ned.deilysetrecipients: + ned.deily, ronaldoussoren, pjenvey, petegibson
2009-10-30 06:26:14ned.deilysetmessageid: <1256883974.44.0.446612013588.issue7240@psf.upfronthosting.co.za>
2009-10-30 06:26:13ned.deilylinkissue7240 messages
2009-10-30 06:26:12ned.deilycreate