Getting output from external programs...
Ten
runlevelten at gmail.com
Mon Jun 19 12:53:14 EDT 2006
On Monday 19 June 2006 03:44, Cameron Laird wrote:
> In article <mailman.7187.1150675222.27775.python-list at python.org>,
> Ten <runlevelten at gmail.com> wrote:
>
> >You can do this in various ways, ranging from the very simple and not very
> > good
> >
> >from commands import getoutput
> >
> >x=getoutput(command)
> >
> >
> >- to your more common and better popens.
> >
> >ie:
> >
> >import popen2
> >
> >(stdOut, stdIn) = popen2.popen4(command)
> >
> >x=stdOut.readlines()
> >
> >- asynchronously if appropriate.
> >
> >How are you running the command at the moment?
>
> .
> .
> .
> Why deprecate commands.getoutput()? Are you merely
> observing that it's applicable in fewer circumstances?
Absolutely so.
Commands.getoutput is simple, quick and useful, just less versatile. Maybe
"not very good" is a pretty vague, almost emotive-sounding way of putting it.
My bad. :-)
Cheers,
Ten
--
There are 10 types of people in this world,
those who understand binary, and those who don't.
More information about the Python-list
mailing list