Hi Kent,
> > > > [code] > > # filewatcher.py > > 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(1.0, watch, file(sys.argv[1])) > > s.startService() > > reactor.run() > > s.stopService() > > [/code] > > > > What performance problems you you anticipate? I don't know much > about Twisted but my understanding is that tasks are run in a > single thread when they are ready. In your case you are > scheduling a simple task to run every second. I would think that > you could schedule several such tasks and they would each run > every second. If your task were time-consuming you might have to > worry about doing something different but in this case I think it > will be fine. Just try something like > > for name in sys.argv[1:]: > s = internet.TimerService(1.0, watch, file(name)) > s.startService() > That's one way I was thinking of doing it. I'll run it like that on about 10 active files and see how it stacks up. > twisted.protocols.basic.FileSender and > twisted.internet.stdio.StandardIO look like they may be starting points. Thanks for the twisted pointers. I've been using twisted for a little while but it's such a massive thing that it can be difficult to fully understand whats happening. Thanks for you help, Nick . _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor