Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- self.myOut = stdOutCustom(self.debug_log)
- self.orig_out = sys.stdout
- self.orig_err = sys.stderr
- class stdOutCustom(object):
- errors = 'strict'
- encoding = 'utf-8'
- def __init__(self, fp):
- self.log = fp
- def write(self, d):
- self.log.write(d.encode('utf-8'))
- def write(self, d):
- if isinstance(d, str):
- self.log.write(d.encode('utf-8'))
- else:
- self.log.write(d)
- def flush(self):
- self.stdout.flush()
- def __del__(self):
- self.log.close()
Advertisement
Add Comment
Please, Sign In to add comment