def outputRedirectStart(errToOut=False):
 global STDOUT_TEMP
 global STDERR_TEMP
 STDOUT_TEMP = open('ip_session.log', 'w')
 sys.stdout = STDOUT_TEMP
 if errToOut:
  STDERR_TEMP = STDOUT_TEMP
 else:
  STDERR_TEMP = open('ip_session_stderr.log', 'w')
 sys.stderr = STDERR_TEMP

def outputRedirectStart ( errToOut = False ) : global STDOUT_TEMP global STDERR_TEMP STDOUT_TEMP = open ( 'ip_session.log' , 'w' ) sys . stdout = STDOUT_TEMP if errToOut : STDERR_TEMP = STDOUT_TEMP else : STDERR_TEMP = open ( 'ip_session_stderr.log' , 'w' ) sys . stderr = STDERR_TEMP
redirects stdout/stderr to files .