Communication between python scripts

2005-03-01 Thread Chris
Is there a preferred method for having different scripts on different 
computers communicate with each other?

For example, script A could tell script B that it is done with a certain 
process.

I know how to do this using e-mail, but I would like a more direct 
method if possible. If my ISP's mail server goes down, for example, I 
don't want my processes to come to a screeching halt.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Communication between python scripts

2005-03-01 Thread Chris Grebeldinger
There are many ways, for instance you could use SimpleXMLRPCServer and
have one app expose a done_process() function, and use that to
synchronize.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Communication between python scripts

2005-03-01 Thread Peter Hansen
Chris wrote:
Is there a preferred method for having different scripts on different 
computers communicate with each other?

For example, script A could tell script B that it is done with a certain 
process.

I know how to do this using e-mail, but I would like a more direct 
method if possible. If my ISP's mail server goes down, for example, I 
don't want my processes to come to a screeching halt.
Google for "python remote objects" and click on "I'm Feeling Lucky".
--
http://mail.python.org/mailman/listinfo/python-list


Re: Communication between python scripts

2005-03-01 Thread André Søreng
Chris wrote:
Is there a preferred method for having different scripts on different 
computers communicate with each other?

For example, script A could tell script B that it is done with a certain 
process.

I know how to do this using e-mail, but I would like a more direct 
method if possible. If my ISP's mail server goes down, for example, I 
don't want my processes to come to a screeching halt.

Probably the simplest way would be to use XMLRPC. Python
supports it both on client and server side.
client access:
http://www.python.org/doc/2.4/lib/module-xmlrpclib.html
server:
http://www.python.org/doc/2.4/lib/module-SimpleXMLRPCServer.html
Examples to get you going are also available in the library reference.
Other that that, you could also just use regular sockets.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Communication between python scripts

2005-03-01 Thread Heiko Wundram
Am Dienstag, 1. März 2005 21:54 schrieb Chris:
> Is there a preferred method for having different scripts on different
> computers communicate with each other?

You have several options at your disposal.

1) Use mail-communication (like you said, a combination of smtplib and 
poplib/imaplib),

2) have the scripts update web-pages which can be accessed by the other script 
to read status information (a combination of ftplib and urllib2),

3) write a socket server process running on some computer which can be 
connected by both clients to update certain flags which can then be read by 
the other process (see SimpleXMLRPCServer),

4) write both programs so that they spawn an additional thread which runs a 
socket server (e.g. SimpleXMLRPCServer) which can be used to query their 
state from the other process,

5) use some RPC-package like Pyro (http://pyro.sourceforge.net/), 
Twisted+Banana (http://www.twistedmatrix.com/), CORBA, etc.

6) do something else which doesn't come to my mind just now. ;)

You have many options at your disposal, and which of the above options you 
choose will depend largely on what your prerequesites are, such as:

1) Do both machines reside on the same network, or do they need gateways to 
communicate (like a mail server in option 1)?

2) Are you willing to install packages like Pyro which do not belong to the 
stdlib on both computers?

3) Can you run some server process on a machine which is reachable by both 
processes?

4) And anything else which I didn't think of just now... ;)

I'd say, if you aren't constrained in some form, go for Pyro to start with. 
Nice and simple.

-- 
--- Heiko.


pgpJyI4QBv0U9.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Communication between python scripts

2005-03-01 Thread Do Re Mi chel La Si Do
Hi !

A socket (TCP) server is very easy, and 30 x faster than XML-RPC.

@-salutations
-- 
Michel Claveau


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Communication between python scripts

2005-03-01 Thread Do Re Mi chel La Si Do

Hi !

A socket (TCP) server is more simplist than XML-RPC, and 30 x faster.

@-salutations
-- 
Michel Claveau



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Communication between python scripts

2005-03-01 Thread Peter Hansen
Do Re Mi chel La Si Do wrote:
A socket (TCP) server is more simplist than XML-RPC, and 30 x faster.
Is it "more simplist" in terms of reliability?  Generally
most people writing low-level socket code, even in Python,
do an absymal job of it.  Far better to avoid reinventing
the wheel and use something higher level where the odds
are good that most of the nitty-gritty details have been
handled and tested already.
And as for "30x faster", please repeat after me: "premature
optimization is the root of all evil in programming".
-Peter
--
http://mail.python.org/mailman/listinfo/python-list


Re: Communication between python scripts

2005-03-04 Thread Stephen Toledo-Brown
Heiko Wundram wrote:
Am Dienstag, 1. März 2005 21:54 schrieb Chris:
Is there a preferred method for having different scripts on different
computers communicate with each other?

You have several options at your disposal.

6) do something else which doesn't come to my mind just now. ;)
The main one missing seems to be using asynchronous middleware - either 
database or Messsage Queuing. e.g. there's pymqi for a Python interface 
to WebSphereMQ, or there are some lighter-weight open-source 
alternatives if you don't need that level of robustness.

Note that between all these alternatives, there are 2 fundamentally 
different categories: synchronous (sockets, RPC) or asynchronous (email, 
ftp, MQ, etc). Getting that first decision right is much more important 
than choosing between the methods within each category because 
synchronous vs. asynchronous affects your basic app design, whereas 
refactoring between different synchronous methods or between 
asynchronous methods, is relatively easy.
--
Steve Toledo-Brown
Speaking for myself only.
Domain: uk.ibm.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Communication between python scripts

2005-03-04 Thread [EMAIL PROTECTED]
Another reason NOT to use XML-RPC:

PSF-2005-001 - SimpleXMLRPCServer.py allows unrestricted traversal
http://python.org/security/PSF-2005-001/

-- 
http://mail.python.org/mailman/listinfo/python-list