os.system question

Asun Friere afriere at yahoo.co.uk
Wed Aug 13 08:38:56 CEST 2008

On Aug 13, 8:58 am, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:
> On Mon, 11 Aug 2008 19:28:13 -0700, Asun Friere wrote:
> > but if I was in a hurry to find out who I was I would be tempted still
> > to use the deprecated "os.popen('whoami').read()".
> Is it really deprecated? Since when? I'm using Python 2.5 and it doesn't
> raise any warnings or mention anything in the doc string.

I should perhaps have put 'deprecated' in quotation marks?  Note the
post I was responding to and my own stated preference.  Though I
admit, I have been trying out Popen just recently.

> The current documentation does say:
> "The subprocess module provides more powerful facilities for spawning new
> processes and retrieving their results; using that module is preferable
> to using this function."
> http://docs.python.org/lib/os-newstreams.html#os-newstreams
> but that's not the same as deprecating os.popen.

Current documentation also states:

"[The subprocess] module intends to replace several other, older
modules and functions, such as: ... [inter alia] ... os.system,
os.popen*, commands.*"


Which is also not exactly the same thing as deprecating os.popen, but
it does sound somehwat more ominous.  One hopes the subprocess module
is not successful in realising its intentions.

I note 3.0 runs os.popen without complaint (and had thought to mention
that in my previous).  Right now I'm wondering whether I should
install the beta 2.6 to see whether Wotjek is pulling our leg or
not. :)

More information about the Python-list mailing list