I am trying to learn python. This a script I wrote to check internet connection
import os
import urllib2
from time import sleep
REMOTE_SERVER = \"www.google.co.u
Since you haven't imported socket
, your reference to socket.gethostbyname
will fail with a NameError. But you're catching and silencing every single exception in your try/except block, including that very error. You should never ever do a blank except in the first place, and especially never just to have pass
.
Remove that try/except, or limit it to exceptions you know you can handle.