Using OS time (Donn Cave)
valhalla
tireseas at onetel.com
Fri Jun 20 15:34:07 EDT 2003
On Friday 20 Jun 2003 20:08, donn cave wrote:
> import os
> import select
> class TimeoutError(Exception):
> pass
> def readto(maxsize, timeout):
> r, w, e = select.select([0], [], [], timeout)
> if r:
> return os.read(0, maxsize)
> else:
> raise TimeoutError
> I used 0 and os.read where you might currently be using the stdin
> file object. stdin reads from unit 0, but it adds some buffering
> that can confuse matters when also using select.
> Stay away from signals when possible - if there's anything worse
> than signals, it's signals in Python.
> Donn Cave, donn at u.washington.edu
Thanks Donn
Could you walk me through what you are doing in the 'readto' function ... I'm
a little slow on the uptake.
What's the deal with signals in Python?
Thanks
Andy
--
====================
|| Reg. Linux User: 313143 ||
====================
Sign the Petition:
http://www.PetitionOnline.com/endtcpa1/
More information about the Python-list
mailing list