def eval(self, code, mode='single'): """Evaluate code in the context of the frame.""" if isinstance(code, string_types): if isinstance(code, text_type): code = UTF8_COOKIE + code.encode('utf-8') code = compile(code, '<interactive>', mode) if mode != 'exec': return eval(code, self.globals, self.locals) exec_(code, self.globals, self.locals)
def runcode(self, code): try: exec_(code, self.globals, self.locals) except Exception: self.showtraceback()