Triggering a Python process

DeepBleu DeepBleu at DeepBleu.org
Fri Jan 11 19:35:38 EST 2002


"Chris Liechti" <cliechti at gmx.net> wrote in message
news:Xns9193F1FA8D9BBcliechtigmxnet at 62.2.16.82...
> "DeepBleu" <DeepBleu at DeepBleu.org> wrote in
> news:u3u7qegthndc3 at corp.supernews.com:
> > The Python project I am working on so far does the following:
> > 1.  Allows users via a browser to upload a file to a Solaris 8 machine
> > using Python CGI.  The script inspects the file uploaded to determine
> > if it is zipped or not.  If zipped, it unzips it into its components.
> > Then it performss some rules on the text in the file,  Then it FTP's it
> > into ANOTHER Solaris 8 machine.  This is all in one script.
> > 2.  The files received on the second machine are then sent using a
> > second Python script into an Oracle database processing facility.
> >
> > The second Python script is run every couple of hours to check for any
> > files that were FTP'd.
>
> why use FTP? if its only a python<->python conversation you could use pyro
> http://pyro.sourceforge.net/ the you can simply call method on an object
on
> the second machine with the data.
>
I'll check Pyro out and study it.

> or handcraft you own protocol over TCP and implment it in both python
> scripts.
>
This maybe quite advanced for me.  Even one week ago I did not know that
zipfile module existed.  With deadlines looming I have to work with what I
have for now and advance my skills with what you suggest at a later time
(meaning on my own time at home over weekends :)
After having posted my message I discovered the telnetlib module (more on
this below).  This was a life saver.

> > So, this is my question:
> > Are there any 'fancy' methods by which the second Python script on the
> > second machine is automatically triggered when the file is FTP'd
> > successfully from the first macine to the second machine?
>
> - maybe your FTP server has some scripts that can be executed on
> login/logout? then you could use signals.
>
Out of the question in my case.

> - open a socket on second machine ant wait for a command
>
A good idea!

> - you could even login to the remote machine (via telnetlib or better ssh
> and os.popen) and execute such an update tool
>
This is exactly what I discovered and that is what I did :)  And it worked
via telnetlib.
I opened a telnet session using telnetlib after FTP'ing and started the
python script on the 2nd machine.
However, you have given me ideas to pursue.  Thanks a lot!
DeepBleu





More information about the Python-list mailing list