Timeout on read()?

Moshe Zadka moshez at math.huji.ac.il
Mon Aug 21 01:39:28 EDT 2000


On 20 Aug 2000, Gerrit Holl wrote:

> On Wed, 16 Aug 2000 10:46:08 +0800, lec wrote:
> > Is it possible to implement timeout on read?
> > 
> > eg.
> > 
> > answer = sys.stdin.readline()
> > 
> > but I want it to timeout after 30 seconds.
> 
> It's not crossplatform, but on Unix, the signal
> module is your friend.

On the other hand, for good cross-platform solution, you can
use the "select" module. 

--
Moshe Zadka <moshez at math.huji.ac.il>
There is no IGLU cabal.
http://advogato.org/person/moshez





More information about the Python-list mailing list