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)
Example #2
0
 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)
Example #3
0
 def runcode(self, code):
     try:
         exec_(code, self.globals, self.locals)
     except Exception:
         self.showtraceback()
Example #4
0
 def runcode(self, code):
     try:
         exec_(code, self.globals, self.locals)
     except Exception:
         self.showtraceback()