Home
Manage Your Code
Snippet: file watcher (Python)
Title: file watcher Language: Python
Description: file watcher Views: 1174
Author: Krassimir Krustev Date Added: 12/5/2005
Copy Code  
from twisted.application import internet

    
def watch(fp):
    fp.seek(fp.tell())
    for line in fp.readlines():
        sys.stdout.write(line) 

import sys
from twisted.internet import reactor
s = internet.TimerService(0.1, watch, file(sys.argv[1]))
s.startService()
reactor.run()
s.stopService()
Usage
file watcher
Notes
file watcher