Access Object From 2 Applications or Fix Scheduler

Hendrik van Rooyen mail at microcorp.co.za
Mon Jul 16 08:28:45 CEST 2007


 Robert Rawlins - Think Blue  wrote:


>Hello Guys,
>
>I have two applications which I need to get talking and sharing an object, what
’s the best way to do this? Basically my >first application parses an XML
document into a bunch of lists and tuples etc, and I need to access the data in
these lists >and tuples from my second application. Is this possible? And what’s
the simplest method?
>
>This problem all evolves from a hack/work around I’ve had to place together as
I have been having problems with >sched, these two applications used to be a
single one to start with but for some reason when scheduling tasks using the
>sched module they wouldn’t ever run when supposed too, so I’d schedule it to
run every 2 minutes and it would run >between 3 and 15 minutes :-s so I ripped
it out into its own application and it now runs every 2 minutes exactly.
>
>I either need to fix my sched issues or the memory share, either way I’m quite
happy, just need to get it working >smoothly.
>
>Any ideas?
>

You have already split the thing, so I would:

schedule the XML parser and make it do its stuff.
then pickle the results using cPickle
then from this first thing, either:
write the pickles to temp files and start the second thing
using eg os.system()
or start the second thing and use a named pipe to
pass the pickles over for unpickling and processing,
or use one of the popens,
or have a look at Pyro,
or start the second thing as a thread and use a Queue..

of course this whole scheme will fall apart if the combined
processing takes longer than the scheduling interval.

HTH - Hendrik





More information about the Python-list mailing list