Closed 384ccc4e-cb8f-445e-b7c8-688ad3cd2535 closed 22 years ago
Python 2.1.2 (#31, Jan 15 2002, 17:28:11) [MSC 32 bit (Intel)] on win32.
Under Windoze 98, in a non-console application (pythonw.exe) the sys.std[in|out|err] file objects' fileno() returns -1.
Which is fine. Calls to the write() methods seem to discard the data, which is what I want (when running a cross-platform GUI program with debug print statements).
BUT, when the write() method is called with more than about 4KB, it raises "IOError: [Errno 9] Bad file descriptor", the same as if you had manually called the flush() method.
This IOError happens when write()ing even one character if "pythonw.exe -u" was used to start the GUI.
I work around it by defining my own bit-bucket for sys.std[out|err].
(NOTE: This bug was hard to track down!)
Thanks guys|gals.
Logged In: YES user_id=543663
Hey, I just noticed another bug report has this same problem: [ 706263 ] print raises exception when no console available
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: ```python assignee = None closed_at =
created_at =
labels = ['interpreter-core']
title = 'sys.stdout IOError under Windows'
updated_at =
user = 'https://bugs.python.org/pysquared'
```
bugs.python.org fields:
```python
activity =
actor = 'pysquared'
assignee = 'none'
closed = True
closed_date = None
closer = None
components = ['Interpreter Core']
creation =
creator = 'pysquared'
dependencies = []
files = []
hgrepos = []
issue_num = 710041
keywords = []
message_count = 2.0
messages = ['15265', '15266']
nosy_count = 1.0
nosy_names = ['pysquared']
pr_nums = []
priority = 'normal'
resolution = 'duplicate'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue710041'
versions = []
```