gpt4 book ai didi

python - 在 Python 中,urllib2 给出错误

转载 作者:太空宇宙 更新时间:2023-11-03 23:49:34 25 4
gpt4 key购买 nike

我试过运行这个,

>>> urllib2.urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl')

但是出现这样的错误,谁能告诉我解决方案?

Traceback (most recent call last):
File "<pyshell#11>", line 1, in <module>
urllib2.urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl')
File "C:\Python26\lib\urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "C:\Python26\lib\urllib2.py", line 391, in open
response = self._open(req, data)
File "C:\Python26\lib\urllib2.py", line 409, in _open
'_open', req)
File "C:\Python26\lib\urllib2.py", line 369, in _call_chain
result = func(*args)
File "C:\Python26\lib\urllib2.py", line 1161, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "C:\Python26\lib\urllib2.py", line 1136, in do_open
raise URLError(err)
URLError: <urlopen error [Errno 11001] getaddrinfo failed>

最佳答案

仔细检查域是否可访问。

目前,我在域 - tycho.usno.navy.mil 收到 504 网关超时错误。

看起来该网站已关闭,也 downforeveryoneorjustme.com 说

It's not just you! http://tycho.usno.navy.mil looks down from here.

这就是为什么 getaddrinfo 失败了

关于python - 在 Python 中,urllib2 给出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2818098/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com