Hello all

Just joined the site - mainly due to the fact that 7/10 times I Google a problem this site comes up :)

Not looking for an easy ride, but can someone point me in the direction of a site/tutorial that shows how to run a loop periodically? What I mean by this is that I want to run a loop indefinitely that runs a function every 30 seconds.

Basically I've written a program that checks an FTP server for changes but need to loop this to automate it. Don't worry... it's for a internal system ;-)

I'm sure this is probably very easy to do, but I'm just starting so any pointers you can offer would be appreciated :)

Thanks,

Ollie

Like this?

def periodic():
    global t 
    print "Tic-Tac"
    t = threading.Timer(2, periodic)
    t.start()

t = threading.Timer(2, periodic)
t.start()

Happy coding

Beat slayer that's right on the money! Thanks :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.