How to find out whether computer is connected to internet?
internet-connection, python
Solution
If you have python2.6 you can set a timeout. Otherwise the connection might block for a long time.
try:
urllib2.urlopen("http://example.com", timeout=2)
except urllib2.URLError:
# There is no connection
Problem
How to find out whether computer is connected to internet in python?