forking + stdout = confusion
Michael Hudson
mwh21 at cam.ac.uk
Wed Apr 14 11:58:00 EDT 1999
clarence at silcom.com (Clarence Gardner) writes:
> Clarence Gardner (clarence at silcom.com) wrote:
> : However, your first thought also works, with the same caveat about stderr.
> : stdin, stdout, and stderr all have the __xxx__ copy in the sys module
> : (which I was not aware of).
>
> Mea culpa. The os.close() *is* still necessary. Is there yet another
> copy of these file objects? I tried to find that function that returns
> the reference count, but don't see it in the manual.
It's sys.refcount:
Python 1.5.2 (#2, Apr 14 1999, 13:02:03) [GCC egcs-2.91.66 19990314 (egcs-1.1.2 on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import sys
>>> sys.getrefcount (sys.stdout )
5
Five! I don't know where all of those are...
> --
> -=-=-=-=-=-=-=-=
> Clarence Gardner
> AvTel Communications
> Software Products and Services Division
> clarence at avtel.com
More information about the Python-list
mailing list