Hi, If you want an easy way of iterating over stdin, you may be interested in using this module: http://www.python.org/dev/doc/devel/lib/module-fileinput.html
I've used it with some of my scripts to do something similar. It will not work for a growing file though... Otherwise, you can always try something like this (I also use this method): import sys if a_file_has_been_passed_as_an_argument : myinput=file(os.path.expanduser(args[0]),'r') elif otherwise: myinput=sys.stdin # I have to admit I did not know how to code the EOF, so I used the # 'while line != ""' instead of 'while not EOF' line="a" while line!="": line = myinput.readline() print line[:-1] Enjoy, Guille On Thu, 09 Dec 2004 17:28:56 +0000, Philip Kilner <[EMAIL PROTECTED]> wrote: > Hi List, > > I have a closed-source application which creates log files. I'd like to > capture this logfile data as it is crated, and do clever things with it! > > Is this possible? I guess it must be, because there are "tail" type > utilities for Windows... > > Is it possible in Python? I'd be grateful for any pointers! > > BTW, it doesn't matter either way whether I can somehow pipe the log > output to my program /without/ the file actually being created, or if I > can capture it /as/ it is created - I just need to get my mitts on the > data as it is generated...it would be better if I had the file as well, > but it is not essential... > > Thanks in Anticipation! > > -- > > Regards, > > PhilK > > Email: [EMAIL PROTECTED] / Voicemail & Facsimile: 07092 070518 > > "Work as if you lived in the early days of a better nation." - Alasdair Gray > _______________________________________________ > Tutor maillist - [EMAIL PROTECTED] > http://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor