TeleBot:“无限轮询异常:('连接中止。',RemoteDisconnected('远程端关闭连接而无响应'))

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

我正在使用 Telebot (pyTelegramBotAPI) 来运行我的电报机器人。我在 AWS 上的 ECS 中的 Docker 容器中运行它。 不幸的是,它随机出错:

TeleBot: "Infinity polling exception: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
可能一天一次,也可能一天20次,随机发生。

起初我只使用

bot.polling()
,然后,根据网上的一些建议,我改用更复杂的:

while True:
    try:
        bot.infinity_polling(timeout=60, long_polling_timeout=60, none_stop=True)
    except Exception as e:
        print(f"Exception is: {e}")
        sleep(5)

不幸的是,没有任何帮助,我仍然遇到同样的错误。

我也不明白如果我添加异常处理程序来处理无限轮询错误,如何会发生它。 我非常感谢您的帮助,因为我在网上找不到任何有助于解决问题的信息

python amazon-web-services bots telegram telebot
1个回答
0
投票

遇到了同样的错误,但看起来 infinity_polling 仍在继续。

看起来像是 TeleBot 实现中捕获的内部异常。

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