#!/usr/bin/env python import urllib import errno try: filename, headers = urllib.urlretrieve("http://yandex.ru:12345/", "./some-file.tmp") except IOError as e: print "type(e): ", type(e) print "e.errno: ", e.errno print "type(e.errno): ", type(e.errno) print "e.sterror: ", e.strerror