Если отловить ошибку, то выводится только название ошибки. А как вывести Traceback?
Чтобы код отлавливал ошибку, выводил Traceback и продолжал выполнять код.
Что-то подобное есть в telebot'е.
bot.polling(none_stop=True)
так при ексепшионе выводится трейсбек но код продолжает работать
try:
pass
except Exeption as ex:
print(ex)
# telebot.apihelper.ApiTelegramException: A request to the Telegram API was unsuccessful.
# Error code: 409. Description: Conflict: terminated by other getUpdates request;
# make sure that only one bot instance is running
#########################
# Хочу так:
# ERROR:TeleBot:Exception traceback:
# Traceback (most recent call last):
# File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\telebot\__init__.py", line 976, in __threaded_polling
# polling_thread.raise_exceptions()
# File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\telebot\util.py", line 116, in raise_exceptions
# raise self.exception_info
# File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\telebot\util.py", line 98, in run
# task(*args, **kwargs)
# File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\telebot\__init__.py", line 601, in __retrieve_updates
# updates = self.get_updates(offset=(self.last_update_id + 1),
# File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\telebot\__init__.py", line 575, in get_updates
# json_updates = apihelper.get_updates(self.token, offset, limit, timeout, allowed_updates, long_polling_timeout)
# File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\telebot\apihelper.py", line 333, in get_updates
# return _make_request(token, method_url, params=payload)
# File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\telebot\apihelper.py", line 161, in _make_request
# json_result = _check_result(method_name, result)
# File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\telebot\apihelper.py", line 188, in _check_result
# raise ApiTelegramException(method_name, result, result_json)
# telebot.apihelper.ApiTelegramException: A request to the Telegram API was unsuccessful. Error code: 409. Description: Conflict: terminated by other getUpdates request; make sure that only one bot instance is running