wasm-demo/demo/ermis-f/python_m/cur/0042

38 lines
1.3 KiB
Plaintext

From: mwh21 at cam.ac.uk (Michael Hudson)
Date: 14 Apr 1999 16:58:00 +0100
Subject: forking + stdout = confusion
References: <RUgQ2.31$Oq4.32657@newsfeed.avtel.net> <87n20caldg.fsf@spock.localnet.de> <roy-1304991155360001@qwerky.med.nyu.edu> <ne2R2.33$xa5.26667@newsfeed.avtel.net> <ru3R2.1$3m6.35@newsfeed.avtel.net>
Message-ID: <m3btgrnqif.fsf@atrus.jesus.cam.ac.uk>
X-UID: 42
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