def thesplogStatus(self): "Write status to thesplog" from io import StringIO sd = StringIO() from thespian.system.messages.status import formatStatus try: sd.write('') SSD = lambda v: v except TypeError: class SSD(object): def __init__(self, sd): self.sd = sd def write(self, str_arg): self.sd.write(str_arg.decode('utf-8')) formatStatus(self.getStatus(), tofd=SSD(sd)) thesplog('STATUS: %s', sd.getvalue())