or import sys from urllib2 import * try: r=urllib2.urlopen("http://un-know-n.com/") except URLError,e: print str(e) sys.exit(1) print r.info() se python scope and namespaces ..