redirecting output

Jesper Hertel jh at cddk.dk
Fri Mar 3 05:34:05 EST 2000


Hi Andres,

os.popen(command_line) returns a pipe from wich you can read the standard
output from the command given by command_line.

That is, for example,

     a = os.popen("dir").read()

runs the command "dir" and puts the entire output from the command in the
variable a.

Another function os.popen2() also returns standard error output from the
command, but this does not work in Windows, unfortunately.


Jesper Hertel

Andres M. Hidalgo <andres at hidalgo.cnchost.com> wrote in message
news:89nbc0$2ng at journal.concentric.net...
> How can I run another application(non .py) from within a .py script and
> capture its output  ala perl way, without saving the other apps. output to
a
> file. I'am using python in Windows NT/2K
> Andres
>
>





More information about the Python-list mailing list