Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #8660
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <marek.belisko@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.099 |
| X-Spam-Evidence | '*H*': 0.80; '*S*': 0.00; 'developer': 0.12; '"r")': 0.16; 'thanks,': 0.17; 'seems': 0.20; 'received:209.85.212.46': 0.23; 'received:mail-vw0-f46.google.com': 0.23; 'code': 0.24; 'message-id:@mail.gmail.com': 0.28; 'import': 0.29; 'problem': 0.29; 'changes': 0.31; 'hi,': 0.31; 'print': 0.32; 'it.': 0.33; 'to:addr:python-list': 0.34; 'it?': 0.34; 'skip:# 10': 0.34; 'received:209.85.212': 0.34; "can't": 0.34; 'flag': 0.35; 'freelance': 0.35; 'skip:- 40': 0.35; 'skip:o 20': 0.36; 'file': 0.36; 'but': 0.37; 'could': 0.37; 'received:google.com': 0.38; 'web:': 0.38; 'received:209.85': 0.38; 'data': 0.39; 'event': 0.39; 'to:addr:python.org': 0.39; 'received:209': 0.40; 'tel:': 0.61; 'ves': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=9xmz9Wpni7Lgf6Ki/2Vz0GG4Dzy3sJiXep1JmJHCl84=; b=a/oC2clNMSScYgwLdntQ97bys6cMW9W3mPb04ZtLycrOJlyczewpNaVQNx2dG7XLaB ASrRpPRJdC145wPqon4AP2dZBF1NDczRQ7PYVePnWPBm6ltD3MOh8saFg9QSYux5OaXV 9ogmD1XgyOzukiKN29RcD5zA75jSahWTIRf7Q= |
| MIME-Version | 1.0 |
| Date | Sat, 2 Jul 2011 11:40:46 +0200 |
| Subject | poll of filesystem |
| From | Belisko Marek <marek.belisko@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.557.1309599650.1164.python-list@python.org> (permalink) |
| Lines | 42 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1309599650 news.xs4all.nl 21771 [2001:888:2000:d::a6]:53317 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:8660 |
Show key headers only | View raw
Hi,
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?
Code:
#!/usr/bin/python
import select
from select import POLLIN, POLLERR
p = select.poll()
fd = open("/proc/loadavg", "r")
p.register(fd.fileno(), POLLIN)
while True:
events = p.poll(1000)
if (events == -1):
print "timeout"
fd0, event = events[0]
if (event == POLLIN):
print fd.read()
Thanks,
marek
--
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer
Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
icq: 290551086
web: http://open-nandra.com
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
poll of filesystem Belisko Marek <marek.belisko@gmail.com> - 2011-07-02 11:40 +0200 Re: poll of filesystem Nobody <nobody@nowhere.com> - 2011-07-02 18:49 +0100 Re: poll of filesystem Tim Roberts <timr@probo.com> - 2011-07-02 15:37 -0700
csiph-web