os.system and command output

Fredrik Lundh fredrik at pythonware.com
Wed Jun 7 16:24:24 EDT 2006


A.M wrote:

> Is there anyway I can get the exit code (what os.system returns) from
> os.popen? 

you'd rather kill yourself than read the documentation, right?

     http://www.python.org/doc/lib/os-newstreams.html#os-newstreams

     "The exit status of the command (encoded in the format specified
     for wait()) is available as the return value of the close() method
     of the file object, except that when the exit status is zero
     (termination without errors), None is returned."

</F>




More information about the Python-list mailing list