def Runcommand(self, data): command = data #command = self.read() stdoutOrigin=sys.stdout try: sys.stdout = open("command1.txt", "w") exec(command) sys.stdout=stdoutOrigin with open("command1.txt","r") as f: result = f.read() print(result) self.write(result.encode()) except Exception as e: s=str(e) error=''.join((s,'\n')) self.write(error.encode()) finally: f.close()
local variable 'f' referenced before assignment
f
try
with
finally
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)