[Tutor] Async Events (or How to manage interrupts in Python?)

Alan Trautman ATrautman at perryjudds.com
Mon Dec 29 12:02:10 EST 2003


Hector,

I can think of three options:
1. Multithreading of the whole procedure. 
	i.e.... start seeker, if it finds file(s), trigger a thread for each
files found.
2. Recursive copying of the files to and from the server. If each function
returns true then trigger tee next function. (come to think of it, it might
be useful to thread the resulting processing of the files)
3. Create a class object that handles all of the functions and assign each
file found to a different class object. The __init__ functions will do all
of the inbound processing and when you are ready to move back all of the
objects create a function that copies back all copied objects with a status
of "done" or something. 

Many combinations of these will work just trying to give you some ideas.

HTH,
Alan

 
-----Original Message-----
From: "Héctor Villafuerte D." [mailto:hec.villafuerte at telgua.com.gt]
Sent: Monday, December 29, 2003 12:49 PM
To: tutor at python.org
Subject: [Tutor] Async Events (or How to manage interrupts in Python?)


Hi all,
First, let me tell you what all this is about. I have a very nice script 
that does the following:
1. It checks if there is a file in an Open VMS server.
2. If it finds the file, it connects via TELNET (using telnetlib, of 
course!) and ZIP's it.
3. Once the file is compressed, it GET's it via FTP (using ftplib)
4. When the file is in my local machine, the script does some processing 
on it.
5. If the script was given more than one file to look at the VMS server 
it goes back to Step 1.

Quite simple, right?
The thing is that I don't want this to perform sequentially... it's such 
a waste of time!
Because while the script is in Steps 3 and 4, it could perfectly be 
executing Steps 1 and 2.
When I used to program microcontrollers (PICs) we had good old 
interrupts to handle things
like this. Any ideas how to do this in Python?

Thank you so much, in advance.
Hector


_______________________________________________
Tutor maillist  -  Tutor at python.org
http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list