Raw Sockets vs. What?

Fredrik Lundh fredrik at pythonware.com
Sat Dec 11 14:58:43 CET 2004


"Matt" wrote:

> So, the question: How to communicate between two instances of the
> python interpreter? Specifically, I need to pass the api and objects
> from bdb, the base class for the debugger. One interpreter runs the
> ide, the other the debugger and client code. We were talking and just
> opening a socket and doing the rest from there came up. This, to me,
> (admitedly a java guy) seems like a lot of work. If it were just
> setting breakppoints and stepping, well ok. But I also want to have
> introspection on the debugger side objects.
>
> I could use raw sockets and write a bunch of stuff.
>
> Does anyone have a suggestion about some pythonesque way to tackle
> this?

let the debugger listen to a randomly chosen local port, let the client wrapper
connect back to the debugger via that port, and use a suitable marshalling layer
to wrap commands and data for the introspection part.  This has been done many
times by many IDE developers (including yours truly).  Designing the "RPC API"
is the only tricky part here, and it doesn't have to be that tricky (some people
are known to use really simply stuff, such as XML-RPC, for this purpose).

Unless I'm completely mistaken, recent versions of IDLE have a remote debugger
designed and implemented by GvR himself.  Maybe you could use that code right
out of the box?

</F> 






More information about the Python-list mailing list