When running the program cpu usage is 100%. Here is the part that is running;

def tail_it(fname, bufsize, linesep):
    """Update if monitored file time changes"""
    old_time = os.stat(fname).st_mtime
    while True:
        new_time = os.stat(fname).st_mtime
        if new_time > old_time:
            time.sleep(sec_to_wait)
            updated = return_tail(fname, bufsize, linesep)
            for i in updated:
                print i
        old_time = new_time

It is waiting here;
new_time = os.stat(fname).st_mtime

Why would something like that happen and is there any way to fix it? The program is just for me to learn Python, if I wanted to tail a log file I would just use tail, but an understanding may help in the future.
thanks,
-david


--
Powered by Gentoo GNU/Linux
http://linuxcrazy.com
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to