def run(pythonfile):
    # Output transport/protocol
    output_transport, output_protocol = yield from loop.connect_write_pipe(BaseProtocol, os.fdopen(0, 'wb'))

    with raw_mode(sys.stdin.fileno()):
        # Enter alternate screen buffer
        with alternate_screen(output_transport.write):
            # Create session and renderer
            session = Session()
            renderer = PipeRenderer(weakref.ref(session), output_transport.write)
            session.add_renderer(renderer)

            # Setup layout
            window = Window()
            session.add_window(window)
            application_pane = ApplicationPane(pythonfile)
            debugger_pane = DebuggerPane()
            window.add_pane(application_pane)
            window.add_pane(debugger_pane, vsplit=True)

            # handle resize events
            call_on_sigwinch(session.update_size)

            # Input transport/protocol
            input_transport, input_protocol = yield from loop.connect_read_pipe(
                                lambda:PyMuxDebugInputProtocol(session), sys.stdin)

            # Wait for everything to finish
            yield from asyncio.gather(
                    asyncio.async(application_pane.run()),
                    asyncio.async(debugger_pane.run()))
    def _run(self):
        with raw_mode(0):
            # Open stdout
            output_transport, output_protocol = yield from loop.connect_write_pipe(
                            BaseProtocol, os.fdopen(0, 'wb', 0))

            # Establish server AMP connection
            def factory():
                return DebugClientProtocol(self)

            client = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
            client.connect('/tmp/python-debugger')
            transport, self.amp_protocol = yield from loop.create_connection(factory, sock=client)

            # Create command line
            self.commandline = DebugPrompt(self, output_transport)

            # Input
            input_transport, input_protocol = yield from loop.connect_read_pipe(
                            lambda:InputProtocol(self.commandline), os.fdopen(0, 'rb', 0))

            # Run loop and wait until we are completed.
            yield from self.done_f