Blocking I/O is the scourge of reliable Internet programs. Python's simple network libraries like urllib are surprisingly ænemic with respect to timeout options. Happily, Python 2.3 includes two new functions in the socket module: getdefaulttimeout and setdefaulttimeout.
except IOError, e:
  # handle timeout
There are more sophisticated ways to do nonblocking I/O in Python, but for simple stuff this works.
  2003-08-25 00:29 Z