[Tutor] Problem with threading

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Tue May 3 09:57:48 CEST 2005



On Tue, 3 May 2005, Alberto Troiano wrote:

> In answer to Matt the cameras push the photos via ftp at my server at 1
> photo every 3 seconds

Hi Alberto,

Just as another note: the folks here have no idea who you mean by Matt.
I do know that you mean Matt from python-help at python.org, but the folks on
Tutor now have no clue what we're talking about.  *grin*

That's sorta why it's not such a good idea to crosspost to both lists,
because now we have a conversation where not everyone can see each other.
I'll put Matt in CC, but let's try to avoid this situation next time.


> What can I do????????????

I believe that cron has a resolution of a minute, so now it doesn't sound
that cron is so viable.  But how about writing a program that just
continues to run as a "daemon" service in the background?  A simple
example is something like:

######
import time
while True:
    ## do something
    time.sleep(delay)
######

This isn't a true daemon, since it's not detached from the terminal.  But
the Python Cookbook mentions something a little more polished here:

    http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/278731

and this should be a basis for writing a ftp-polling daemon.


Best of wishes to you!



More information about the Tutor mailing list