closing stdin, stdout and stderr

Donn Cave donn at
Tue Dec 27 18:40:17 CET 2005

In article <mailman.2567.1135642534.18701.python-list at>,
 Martijn Brouwer <e.a.m.brouwer at> wrote:
> I read this one, which was the reason that I tried os.close instead of
> sys.stdXXX.close(). But I would like to know why it does not close a
> file discriptor is I call its close method().

They're special.  I suppose because of internal dependencies - last
chance exception handler etc. - they are created without a close
function, internally, so close() has no effect.   I don't know if it
really makes any sense, since anyway one may close the file descriptors
directly as you did.

   Donn Cave, donn at

More information about the Python-list mailing list