示例#1
0
    def run(self, pipe, no_ipython, no_bpython):
        if pipe:
            # User is attempting to pipe in script through stdin.
            text = sys.stdin.read()
            exec(text, None, _make_context())
            return

        # Try IPython (with autoreload)
        try:
            from IPython.terminal.ipapp import TerminalIPythonApp
            app = TerminalIPythonApp(user_ns=self.get_context())
            config_file = path.join(
                path.dirname(alchemist.__file__), "ipython_startup.ipy")
            app.init_shell()
            app.shell.banner = self.banner
            app.initialize(argv=["-i", config_file])
            app.start()
            return
        except ImportError:
            pass

        # Fallback to normal cycle.
        super(Shell, self).run(no_ipython=no_ipython, no_bpython=no_bpython)
示例#2
0
    def run(self, pipe, no_ipython, no_bpython):
        if pipe:
            # User is attempting to pipe in script through stdin.
            text = sys.stdin.read()
            exec(text, None, _make_context())
            return

        # Try IPython (with autoreload)
        try:
            from IPython.terminal.ipapp import TerminalIPythonApp
            app = TerminalIPythonApp(user_ns=self.get_context())
            config_file = path.join(path.dirname(alchemist.__file__),
                                    "ipython_startup.ipy")
            app.init_shell()
            app.shell.banner = self.banner
            app.initialize(argv=["-i", config_file])
            app.start()
            return
        except ImportError:
            pass

        # Fallback to normal cycle.
        super(Shell, self).run(no_ipython=no_ipython, no_bpython=no_bpython)