尽管捕获到异常,但仍打印回溯
Traceback is Printed Despite Exception Being Caught
偶尔,我会无法收到 send/receive 这个 GroupMe API wrapper 的请求。我可以捕捉到引发的异常,但我仍然得到一个冗长的回溯,尽管程序继续 运行。完整回溯:
could not recieve a response
Traceback (most recent call last):
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\requests\packages\urllib3\connection.py", line 137, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\requests\packages\urllib3\util\connection.py", line 67, in create_connection
for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
File "E:\Users\Sebastian\Anaconda3\lib\socket.py", line 743, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 559, in urlopen
body=body, headers=headers)
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 345, in _make_request
self._validate_conn(conn)
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 784, in _validate_conn
conn.connect()
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\requests\packages\urllib3\connection.py", line 217, in connect
conn = self._new_conn()
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\requests\packages\urllib3\connection.py", line 146, in _new_conn
self, "Failed to establish a new connection: %s" % e)
requests.packages.urllib3.exceptions.NewConnectionError: <requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000002CD65CF60F0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\requests\adapters.py", line 376, in send
timeout=timeout
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 609, in urlopen
_stacktrace=sys.exc_info()[2])
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\requests\packages\urllib3\util\retry.py", line 273, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
requests.packages.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.groupme.com', port=443): Max retries exceeded with url: /v3/chats?token=98d6c1109f660135d705089a21c58196 (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000002CD65CF60F0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\groupy\session.py", line 25, in request
response = super().request(*args, **kwargs)
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\requests\sessions.py", line 468, in request
resp = self.send(prep, **send_kwargs)
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\requests\sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\requests\adapters.py", line 437, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.groupme.com', port=443): Max retries exceeded with url: /v3/chats?token=98d6c1109f660135d705089a21c58196 (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000002CD65CF60F0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',))
我觉得特别有趣的是它在 Traceback 之前以 "could not recieve a response"(包括拼写错误)开头,但我终究找不到那条线在哪里。它肯定不在我的代码中,也不在 groupy 模块的代码中。
不要相信 Github
上的搜索功能
尽管搜索 "recieve" on the repo, only a different occurrence of it showed up. However, the problem was in session.py
,其中记录并引发了异常。
偶尔,我会无法收到 send/receive 这个 GroupMe API wrapper 的请求。我可以捕捉到引发的异常,但我仍然得到一个冗长的回溯,尽管程序继续 运行。完整回溯:
could not recieve a response
Traceback (most recent call last):
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\requests\packages\urllib3\connection.py", line 137, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\requests\packages\urllib3\util\connection.py", line 67, in create_connection
for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
File "E:\Users\Sebastian\Anaconda3\lib\socket.py", line 743, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 559, in urlopen
body=body, headers=headers)
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 345, in _make_request
self._validate_conn(conn)
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 784, in _validate_conn
conn.connect()
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\requests\packages\urllib3\connection.py", line 217, in connect
conn = self._new_conn()
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\requests\packages\urllib3\connection.py", line 146, in _new_conn
self, "Failed to establish a new connection: %s" % e)
requests.packages.urllib3.exceptions.NewConnectionError: <requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000002CD65CF60F0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\requests\adapters.py", line 376, in send
timeout=timeout
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 609, in urlopen
_stacktrace=sys.exc_info()[2])
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\requests\packages\urllib3\util\retry.py", line 273, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
requests.packages.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.groupme.com', port=443): Max retries exceeded with url: /v3/chats?token=98d6c1109f660135d705089a21c58196 (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000002CD65CF60F0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\groupy\session.py", line 25, in request
response = super().request(*args, **kwargs)
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\requests\sessions.py", line 468, in request
resp = self.send(prep, **send_kwargs)
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\requests\sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "E:\Users\Sebastian\Anaconda3\lib\site-packages\requests\adapters.py", line 437, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.groupme.com', port=443): Max retries exceeded with url: /v3/chats?token=98d6c1109f660135d705089a21c58196 (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000002CD65CF60F0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',))
我觉得特别有趣的是它在 Traceback 之前以 "could not recieve a response"(包括拼写错误)开头,但我终究找不到那条线在哪里。它肯定不在我的代码中,也不在 groupy 模块的代码中。
不要相信 Github
上的搜索功能尽管搜索 "recieve" on the repo, only a different occurrence of it showed up. However, the problem was in session.py
,其中记录并引发了异常。