close failed: [Errno 0] No error goes to stdout

Yoav yoav_artzi at il.vio.com
Sun Aug 28 15:23:25 CEST 2005


I use the following code to the console output:

def get_console(cmd):
         try:
                 p_in, p_out, p_err = os.popen3(cmd)
         except:
                 pass
         out_str = ''
         for obj in p_out:
                 out_str = out_str + obj
         for obj in p_err:
                 out_str = out_str + obj
         return out_str


for some reason some exceptions (stderr outputs) are not captured by the 
try method, and slip to the screen. Any one has any idea on how can 
prevent from any output that I don't want to?
The output I get on these exceptions is:
close failed: [Errno 0] No error


thanks.



More information about the Python-list mailing list