[Python-bugs-list] [ python-Bugs-710041 ] sys.stdout IOError under Windows

SourceForge.net noreply@sourceforge.net
Wed, 26 Mar 2003 05:43:45 -0800


Bugs item #710041, was opened at 2003-03-26 13:43
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=710041&group_id=5470

Category: Python Interpreter Core
Group: Python 2.1.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Graham Horler (grahamh)
Assigned to: Nobody/Anonymous (nobody)
Summary: sys.stdout IOError under Windows

Initial Comment:
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.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=710041&group_id=5470