Belisko Marek <marek.beli...@gmail.com> wrote:
>
>just want to use poll method to get data from /proc file system. Use
>simple code for it. Problem is it seems poll return POLLIN flag but
>when I try to read data it's always empty. Could be a problem changes
>are so fast that print can't print it?

Poll doesn't make sense here.  The data in /proc/loadavg data is not text
data that gets updated periodically.  There is no file on disk somewhere
called /proc/loadavg.  Instead, reading /proc/loadavg causes a call into a
kernel driver, and reads data directly from variables stored in the kernel.
The data is ALWAYS available.

If you want the data once a second, just do it the easy way:

    import time
    while True:
        print open('/proc/loadavg').read()
        time.sleep(1)
-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to