os.system question

Mike Driscoll kyosohma at gmail.com
Wed Aug 13 15:50:01 EDT 2008


On Aug 13, 1:38 am, Asun Friere <afri... at yahoo.co.uk> wrote:
> 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.*"
>
> http://docs.python.org/lib/module-subprocess.html
>
> 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. :)

That was the wording I was referring to. Now that I re-read it, I
guess it doesn't say "deprecated" per se, but it seemed to imply it.
And I think one of the Python luminaries said as much (Holden or
Lundh) in one of their old posts last year.

Mike



More information about the Python-list mailing list