示例#1
0
    def do_console(self, line):
        """console
        When enabled in the configuration file, will startup up an embedded
        interactive Python interpreter. Invoke 'exit()' or 'quit()' to
        escape the interpreter session."""

        enabled = False

        if self.__config_object.has_option('python:console', 'enabled'):
            value = self.__config_object.get('python:console', 'enabled')
            enabled = value.lower() in ('1', 'on', 'yes', 'true')

        if not enabled:
            print >> self.stdout, 'Sorry, the Python console is disabled.'
            return

        locals = {}

        locals['stdin'] = self.stdin
        locals['stdout'] = self.stdout

        console = EmbeddedConsole(locals)

        console.stdin = self.stdin
        console.stdout = self.stdout

        acquire_console(self)

        try:
            console.interact()
        except SystemExit:
            pass
        finally:
            release_console()
示例#2
0
文件: python.py 项目: rajr0/ispyd
    def do_console(self, line):
        """console
        When enabled in the configuration file, will startup up an embedded
        interactive Python interpreter. Invoke 'exit()' or 'quit()' to
        escape the interpreter session."""

        enabled = False

        if self.__config_object.has_option('python:console', 'enabled'):
            value = self.__config_object.get('python:console', 'enabled')
            enabled = value.lower() in ('1', 'on', 'yes', 'true')

        if not enabled:
            print >> self.stdout, 'Sorry, the Python console is disabled.'
            return

        locals = {}

        locals['stdin'] = self.stdin
        locals['stdout'] = self.stdout

        console = EmbeddedConsole(locals)

        console.stdin = self.stdin
        console.stdout = self.stdout

        acquire_console(self)

        try:
            console.interact()
        except SystemExit:
            pass
        finally:
            release_console()
示例#3
0
文件: debugger.py 项目: rajr0/ispyd
    def do_debug(self, line):
        """debug (module:function|module:class.function)
        Run 'pdb' in post mortem mode for the traceback captured against
        the nominated function."""

        if not line in _tracebacks:
            return

        tb = _tracebacks[line]

        debugger = pdb.Pdb(stdin=self.stdin, stdout=self.stdout)
        debugger.reset()

        acquire_console(self)

        try:
            debugger.interaction(None, tb)
        except SystemExit:
            pass
        finally:
            release_console()
示例#4
0
    def do_debug(self, line):
        """debug (module:function|module:class.function)
        Run 'pdb' in post mortem mode for the traceback captured against
        the nominated function."""

        if not line in _tracebacks:
            return

        tb = _tracebacks[line]

        debugger = pdb.Pdb(stdin=self.stdin, stdout=self.stdout)
        debugger.reset()

        acquire_console(self)

        try:
            debugger.interaction(None, tb)
        except SystemExit:
            pass
        finally:
            release_console()