WinError 10061 - 无法建立连接

 finessi_739 发布于 2023-02-12 12:30

我正在调试一个过去有效的简单程序.我已经挑出了发生错误的指令,但我无法弄清楚是什么触发它.我已经阅读了与WinError 10061相关的所有问题,但我没有看到明确的答案

urllib.request.urlopen('http://www.wikipedia.org/')
Traceback (most recent call last):
File "C:\Python33\lib\urllib\request.py", line 1248, in do_open    h.request(req.get_method(), req.selector, req.data, headers)
File "C:\Python33\lib\http\client.py", line 1061, in request    self._send_request(method, url, body, headers)
File "C:\Python33\lib\http\client.py", line 1099, in _send_request    self.endheaders(body)
File "C:\Python33\lib\http\client.py", line 1057, in endheaders  self._send_output(message_body)
File "C:\Python33\lib\http\client.py", line 902, in _send_output    self.send(msg)
File "C:\Python33\lib\http\client.py", line 840, in send    self.connect()
File "C:\Python33\lib\http\client.py", line 818, in connect    self.timeout, self.source_address)
File "C:\Python33\lib\socket.py", line 435, in create_connection    raise err
File "C:\Python33\lib\socket.py", line 426, in create_connection    sock.connect(sa)
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

During handling of the above exception, another exception occurred: 

Traceback (most recent call last):
File "", line 1, in 
urllib.request.urlopen('http://www.wikipedia.org/')
File "C:\Python33\lib\urllib\request.py", line 156, in urlopen   return opener.open(url, data, timeout)
File "C:\Python33\lib\urllib\request.py", line 469, in open    response = self._open(req, data)
File "C:\Python33\lib\urllib\request.py", line 487, in _open    '_open', req)
File "C:\Python33\lib\urllib\request.py", line 447, in _call_chain    result = func(*args)
File "C:\Python33\lib\urllib\request.py", line 1268, in http_open    return self.do_open(http.client.HTTPConnection, req)
File "C:\Python33\lib\urllib\request.py", line 1251, in do_open    raise URLError(err)
urllib.error.URLError: 

我在Windows 8中运行Python 3.我试图关闭防火墙,正如几个人所说,但没有任何改变.我还尝试将Python添加到防火墙允许的应用程序列表中.顺便说一下,几天前,当我从我的电脑上删除了一些应用程序时,程序行没有任何问题.

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有