How to prevent the script from stopping before it should

Fredrik Lundh fredrik at
Mon Jan 17 20:14:36 CET 2005

Steve Holden wrote:

> You will need to import the socket module and then call socket.setdefaulttimeout() to ensure that 
> communication with non-responsive servers results in a socket exception that you can trap.

or you can use asynchronous sockets, so your program can keep processing
the sites that do respond at once while it's waiting for the ones that don't.  for
one way to do that, see "Using HTTP to Download Files" here:

(make sure you read the second and third article as well)


More information about the Python-list mailing list