(self, cmd)
Execute any Python code.
Execute any Python code.
Execute any Python code .
def python(self, cmd):
        """Execute any Python code."""
        buf = io.BytesIO() if PY2 else io.StringIO()
        save_stdout = sys.stdout
        sys.stdout = buf
        try:
            exec(cmd)
        except Exception as e:
            self._handle_exception(e)
        sys.stdout = save_stdout
        logging.debug(buf.getvalue()[:-1])
def python ( self , cmd ) : buf = io . BytesIO ( ) if PY2 else io . StringIO ( ) save_stdout = sys . stdout sys . stdout = buf try : exec ( cmd ) except Exception as e : self . _handle_exception ( e ) sys . stdout = save_stdout logging . debug ( buf . getvalue ( ) [ : - 1 ] )