# $Id$ import time import os def header(message): now=time.strftime("%H:%M:%S", time.localtime()) print "*",now,'--',message def popen(command, fatal=True): (stdin, stdout, stderr) = os.popen3(command) output = stdout.readlines() # filter output generated by set x remove_set_x = lambda line: not line.startswith("+") errors = filter(remove_set_x, stderr.readlines()) if fatal and errors: raise Exception, "\n".join(errors) return (output, errors)