我调试代码时遇到问题,因为我无法理解引发的套接字错误。 这是回溯。
Traceback (most recent call last):
File "clickpression.py", line 517, in <module> presser.main()
File "clickpression.py", line 391, in main
File "clickpression.py", line 121, in clickpress self.refresh_proxies(country=country)
File "clickpression.py", line 458, in refresh_proxies self.proxies = self.get_proxies(country=country)
File "helpers.py", line 72, in wrapper return func(*args, **kwargs)
File "clickpression.py", line 264, in get_proxies self.settings.SUPER_PROXY).read().decode('utf-8')
File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 161, in urlopen return opener.open(url, data, timeout)
File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 463, in open response = self._open(req, data)
File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 481, in _open '_open', req)
File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 441, in _call_chain result = func(*args)
File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 1210, in http_open return self.do_open(http.client.HTTPConnection, req)
File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 1185, in do_open r = h.getresponse()
File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py", line 1171, in getresponse response.begin()
File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py", line 351, in begin version, status, reason = self._read_status()
File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py", line 313, in _read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/socket.py", line 374, in readinto return self._sock.recv_into(b)
ConnectionResetError: [Errno 54] Connection reset by peer
根据errno
库Errno 54
是errno.EXFULL
,在python 3 documentation中被解释为exchange full
。
据我所知,Connection reset by peer
是Errno 104
,即errno.ECONNRESET
。
那么errno.EXFULL
是什么意思?为什么socket用connection reset by peer
描述而不是exchange full
来引发错误。或者这两个错误errno.EXFULL
和errno.ECONNRESET
有什么关系?
PS:I read认为errno 54
可能与http代理有关(我在代码中使用代理)。如果是,怎么做?
您可以在项目中尝试此代码:
如果不起作用,请确保服务器打开TLSv1支持。
我试着用python在OKEX.com上使用WebSocket创建coin market,因为url是一个外部地址,我使用了我们提供的vpn服务,但它仍然可以工作。这是一个回溯代码。
你是通过检查
errno.errorcode[54]
来确定的吗?无论如何-这个库可能有问题。您可以通过查看errno.h
来验证系统中错误代码的含义,例如,借助gcc
:另外,Pythondocumentation说:
很可能系统上的错误号54是ECONNRESET
,并且os.strerror(54)
将证明这一点。既然您已经验证了
os.strerror(54)
返回“Exchange full”,我很困惑为什么错误号54
和错误字符串Connection reset by peer
不匹配。如果这发生在具有strace
或类似内容的系统上,我将进一步检查操作系统通过对受影响进程使用strace -e network
返回的错误。关于您关于EXFULL的问题:它的含义似乎有些依赖于系统;例如,在Linux上,EXFULL只从内核中的少数几个地方返回,唯一与网络相关的地方是在br_if.c有关网络桥的地方,当找不到可用的桥端口号时(其他地方在USB和SCSI驱动程序中)。
相关问题 更多 >
编程相关推荐