getting the output from os.system()

José María y Sagrario sagracoi at larural.es
Sun May 13 15:15:39 EDT 2001


Hi everyone,

When I execute something using os.system(), I cant get the output that is
produces into a variable, it just goes to the standar output, the screen.

What I am actually trying to do is making a python script to execute another
one, and getting the output that it produces... Exactly, the error mesages
that python generates when something goes wrong...

Lets see:

------
#! /usr/bin/python

import os
os.system("im_a_python_script.py")
----------

Well, if there is an error while evaluating "im_a_python_script.py" I would
like to make it into a variable so the first program can handle the error,
thats the whole point.

Thanks a lot.


                            James Gonzalez





More information about the Python-list mailing list