how to deal with socket.error: (10060, 'Operation timed out')

JuHui phpbird at gmail.com
Sat Mar 18 13:53:39 CET 2006


thanks!
I try the "try" before, but can't catch the socket error. so strange,
maybe my code was error.
I wrote a retry code block as below.

import httplib,time

while 1:
    try:
        conn = httplib.HTTPConnection("www.test.com")
        conn.request("GET", "/")
        print "success"
        break
    except:
        print "error"
        time.sleep(2)




More information about the Python-list mailing list