我得到了一個getaddress錯誤,並且在做了一些調查之後,它看起來好像它可能是我的公司內部網不允許連接(我假設由於安全性,雖然很奇怪IE的工作原理,但不允許Python打開一個url)。有沒有安全的方法來解決這個問題?urllib.urlopen無法正常工作。有沒有解決方法?
這裏是確切的錯誤:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
b = urllib.urlopen('http://www.google.com')
File "C:\Python26\lib\urllib.py", line 87, in urlopen
return opener.open(url)
File "C:\Python26\lib\urllib.py", line 203, in open
return getattr(self, name)(url)
File "C:\Python26\lib\urllib.py", line 342, in open_http
h.endheaders()
File "C:\Python26\lib\httplib.py", line 868, in endheaders
self._send_output()
File "C:\Python26\lib\httplib.py", line 740, in _send_output
self.send(msg)
File "C:\Python26\lib\httplib.py", line 699, in send
self.connect()
File "C:\Python26\lib\httplib.py", line 683, in connect
self.timeout)
File "C:\Python26\lib\socket.py", line 498, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
IOError: [Errno socket error] [Errno 11001] getaddrinfo failed
更多信息:我也得到這個錯誤與urllib2.urlopen
在恰好處於飛行模式的Windows機器上也會出現此錯誤。 – 2016-09-21 23:25:20