def set_errout(fp):
 import commands
 if fp:
  commands.ERR = fp
 else:
  commands.ERR = sys.stderr

def set_errout ( fp ) : import commands if fp : commands . ERR = fp else : commands . ERR = sys . stderr
have error output from twill go to the given fp instead of stderr .