On Feb 2, 5:02 am, [EMAIL PROTECTED] (John J. Lee) wrote: > "dumbkiwi" <[EMAIL PROTECTED]> writes: > > 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? > > Are you on Windows or something Unixy?
Linux > > Presumably Windows? (Unix systems almost always have at least a > loopback interface) > > John Sorry, I should have been more specific. The network interfaces are up - ie lo and eth1, it's where the wireless connection has dropped out. Is the best solution to test for a wireless connection through / proc before trying to download data? -- http://mail.python.org/mailman/listinfo/python-list