urllib2 hangs "forever" where there is no network interface

dumbkiwi dmbkiwi at gmail.com
Thu Feb 1 02:41:59 EST 2007


I have written a script that uses the urllib2 module to download web
pages for parsing.

If there is no network interface, urllib2 hangs for a very long time
before it raises an exception.  I have set the socket timeout with
socket.setdefaulttimeout(), however, where there is no network
interface, this seems to be ignored - presumably, because without a
network interface, there is nothing for the socket module to interact
with.

So, can someone point me in the right direction, so that I can catch
an exception where there is no network interface?




More information about the Python-list mailing list