IOError on file close

Michael S. Fischer michael+usenet at dynamine.net
Fri Mar 29 18:28:00 EST 2002


On 30 Mar 2002 00:11:37 +0100, Martin v. Loewis <martin at v.loewis.de> wrote:
> "Michael S. Fischer" <michael+usenet at dynamine.net> writes:
> 
>> It appears that the write() call is the one that's failing, not the
>> close() call.  Python is throwing the exception at the wrong time. 
>> Should I report this as a Python bug?
> 
> Not really. My guess is that the C library buffers the write call, and
> attempts to flush the stream when closing the file. This, in turn,
> produces the error - the write itself succeeds. 
> 
> Just try opening the file without buffering.

OK, I added a third argument (..., 0) to the open() call and now the
exception is thrown during the write() call.  Thanks.

-- 
Michael S. Fischer / michael at dynamine.net / +1 650-533-4684
Lead Hacketeer, Dynamine Consulting, Silicon Valley, CA



More information about the Python-list mailing list