def runcode(self, code):
        sys.stdout, sys.stderr = StringIO(), StringIO()
        InteractiveConsole.runcode(self, code)
        output, errors = sys.stdout.getvalue(), sys.stderr.getvalue()
        sys.stdout, sys.stderr = sys.__stdout__, sys.__stderr__
        if output or errors:
            self.wait_for_user_input()
        if output:
            self.write(output)
        if errors:
            self.write(errors)
dataset/ETHPy150Open inglesp/prescons/build/lib/prescons/prescons.py/PseudoInteractiveConsole.runcode/original