[Twisted-Python] Looking for a simple file event driven loop using Twisted

Ken Kinder ken at kenkinder.com
Fri Mar 25 19:39:53 EST 2005

It seems to me you probably will either check periodically in the 
reactor, like this:

    def checkFile():
        x = os.stat(file)
        reactor.callLater(.5, checkFile)


Or just start another thread like this:

    def wakeUp():
        (action to take when file changes)

    def checker():
        while 1:
            (code that waits for file to change)



steven howe wrote:

>I'm looking for some example code I can use to build an app from. I
>need to 'wait' or sleep for new data in a file. Then wake and process
>the data.
>The file is a regular file, not a pipe. It is the output of a existing
>program (i.e., not mine to modify). Needless to say, the API for hugh.
>I'm need some help finding the right tools.
>Steven Howe
>Twisted-Python mailing list
>Twisted-Python at twistedmatrix.com

More information about the Twisted-Python mailing list