Get Stdout from external script startet through python

Christian Rapp wasjaja at gmx.de
Sat Nov 16 13:07:40 EST 2002


Seems to work, thanks!

Greets
C. Rapp

"Wojtek Walczak" <gminick at hacker.pl> schrieb im Newsbeitrag
news:slrnatd4f4.8d.gminick at hannibal.localdomain...
> Dnia Sat, 16 Nov 2002 12:40:30 +0100, Christian Rapp napisa³(a):
> > I need to start an external script from inside python. This works just
fine.
> > The called script produces some output on StandardOut, that I need
within
> > the python-script. How do I get this Output into python?
>
> >>> import os
> >>> print os.popen.__doc__
> popen(command [, mode='r' [, bufsize]]) -> pipe
> Open a pipe to/from a command returning a file object.
> >>> a = os.popen("/bin/date")
> >>> print a.read(),
> Sat Nov 16 19:42:59 CET 2002
> >>> a.close()
>
> Is that what you wanted ?
>
> --
> [ Wojtek gminick Walczak ][ http://gminick.linuxsecurity.pl/ ]
> [ gminick (at) hacker.pl ][ gminick (at) underground.org.pl  ]





More information about the Python-list mailing list