I have import urllib2 try: urllib2.urlopen("some url") except urllib2.HTTPError: <whatever> but what I end up is catching any kind of HTTP error. I want to catch only if the specified webpage doesn't exist (404?). Continue reading...