share dictionary between processes
Steve Holden
steve at holdenweb.com
Fri Dec 18 12:27:55 EST 2009
blumenkraft wrote:
> Hi,
>
> I want to share dictionary between two distinct processes.
>
>
> Something like this:
>
> first.py
> import magic_share_module
>
> def create_dictionary():
> return {"a": 1}
>
> magic_share_module.share("shared_dictionary",
> creator.create_dictionary)
> while True:
> pass
>
>
> second.py
> import magic_share_module
> d = magic_share_module.get_shared("shared_dictionary")
> print d["a"]
>
> And then run in command line:
> python first.py &
> sleep 1
> python second.py
>
> I have looked at POSH, but it requires master process that will fork
> childs. I want read-only sharing between completely unrelated
> processes.
> Is it possible?
Take a look at pyro, though it may be overkill for your needs.
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS: http://holdenweb.eventbrite.com/
More information about the Python-list
mailing list