如何解决与更新程序相关的引发的异常,只发生最新的VS代码更新?

问题描述 投票:0回答:1

我正在使用Python Telegram Bot和Visual Studio Code。当我启动我的机器人时,几秒后它会引发一个错误,打开此消息:

Could not load source '<string>': Source unavailable.

以下例外:

Traceback (most recent call last):
File "C:\\Users\\sergi\\AppData\\Local\\Programs\\Python\\Python35\\lib\\site-packages\\telegram\\vendor\\ptb_urllib3\\urllib3\\connectionpool.py", line 398, in _make_request
httplib_response = conn.getresponse()
File "C:\\Users\\sergi\\AppData\\Local\\Programs\\Python\\Python35\\lib\\http\\client.py", line 1198, in getresponse
response.begin()
File "C:\\Users\\sergi\\AppData\\Local\\Programs\\Python\\Python35\\lib\\http\\client.py", line 297, in begin\n    version, status, reason = self._read_status()
File "C:\\Users\\sergi\\AppData\\Local\\Programs\\Python\\Python35\\lib\\http\\client.py", line 258, in _read_status\n    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "C:\\Users\\sergi\\AppData\\Local\\Programs\\Python\\Python35\\lib\\socket.py", line 576, in readinto\n    return self._sock.recv_into(b)
File "C:\\Users\\sergi\\AppData\\Local\\Programs\\Python\\Python35\\lib\\ssl.py", line 937, in recv_into
return self.read(nbytes, buffer)\n  File "C:\\Users\\sergi\\AppData\\Local\\Programs\\Python\\Python35\\lib\\ssl.py", line 799, in read
return self._sslobj.read(len, buffer)\n  File "C:\\Users\\sergi\\AppData\\Local\\Programs\\Python\\Python35\\lib\\ssl.py", line 583, in read
v = self._sslobj.read(len, buffer)\nsocket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:
Traceback (most recent call last)
File "c:\\Users\\sergi\\.vscode\\extensions\\ms-python.python-2019.3.6558\\pythonFiles\\lib\\python\\ptvsd\\_vendored\\pydevd\\_pydevd_bundle\\pydevd_resolver.py", line 213, in _get_py_dictionary
attr = getattr(var, name)
AttributeError: characters_written

这在以前的VS Code版本中没有发生,只会在上次更新时发生。关于如何解决它的任何想法?

python python-3.x visual-studio-code python-telegram-bot
1个回答
0
投票

我通过向Updater添加一些参数来解决它。

updater = Updater(token, request_kwargs={'read_timeout': 15, 'connect_timeout': 15})

您可以尝试使用其他超时值。如果仍然出现错误,请尝试更高的值。

© www.soinside.com 2019 - 2024. All rights reserved.