New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
subprocess.Popen.stdout.flush fails os OS-X 10.6.1 #51489
Comments
subprocess.Popen.stdout.flush() fails on OS-X 10.6.1 under the bundled >>> from subprocess import Popen, PIPE
>>> p = Popen('cat', stdin=PIPE, stdout=PIPE)
>>> p.stdout.flush()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IOError: [Errno 9] Bad file descriptor However it works on Python 2.6.2 on Linux. |
Why are you flushing stdout? It's read-only and flush is for writing. This |
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 >>> 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 As this doesn't seem to be a new issue and can easily be avoided (don't |
Not my code, but as it's using a pipe to communicate with another Is there another way to achieve the same effect, such as reading and |
I don't think so. stdio on OSX has a fdiscard function, but that's not I tend to explicitly synchronize on prompts when communicating with an |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: