class stdout(object):
def __init__(self,realout,prefix):
self.file = realout
self.at_start_of_line = True
self.prefix=prefix
def write(self, text):
if len(text):
if self.at_start_of_line:
text = self.prefix + text
self.file.write(text)
self.at_start_of_line = (text[-1] == '\n')
sys.stdout=stdout(sys.stdout,"OUT ["+f+"]> ")
File "C:\Users\James\Desktop\run.py", line 13, in write
self.file.write(text)
File "C:\Users\James\Desktop\run.py", line 10, in write
if self.at_start_of_line:
AttributeError: 'stdout' object has no attribute 'prefix'
It's not the whole thing but the error is really confusing