我得到了一个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