[Baypiggies] Help ! How to exchange python objects between two python processes on the same machine ?

Keith Dart keith at dartworks.biz
Fri Jul 10 03:03:42 CEST 2009


On Thu, 9 Jul 2009 17:03:33 -0700 (PDT)
David Berthelot <d_berthelot at yahoo.com> wrote:

> So technically I'd like to do:Process1: data =
> ((1,2,"abc",{d:"ef"}),2)                send(data)Process2: data =
> receive();                 print data # And here you get the data
> sent by process1 (and note it's a python object, tuple, dict ...)


Take a look at Pyro (http://pyro.sourceforge.net/). You can write your
own socket interface with serialized data transfer (pickled), but Pyro
already does that for you. It does, however, have some overhead of its
own and might be overkill for what you are doing. But you can decide.
Since it also allows communication between different machines you can
also grow with it. It does require (or work best with) a name server,
which you have to set up. I recently integrated it better into Pycopia.
You can find the Gentoo server startup scripts here:

http://code.google.com/p/pycopia/source/browse/#svn/trunk/QA/etc/init.d/gentoo

Some example usage is here:

http://code.google.com/p/pycopia/source/browse/#svn/trunk/QA/pycopia/remote

(you can remote control a Windows machine from a Linux machine with
it :-) )


Another possibility is using a shared persistent storage with Durus,
which already also has an efficient client-server system with built-in
pickling.


-- 
-- --------------------
Keith Dart
<keith at dartworks.biz>
=======================


More information about the Baypiggies mailing list