When I've tried to send_photo as shown in detailed_example, I got an error: "AttributeError: module 'PIL' has no attribute 'Image'".
This error was described well here: https://stackoverflow.com/a/11911536/9092263. So in accordance to prescriptions, I've made changes and It works fine for me.
Steps to reproduce:
1. initiate bot via TeleBot constructor
2. call function bot.send_photo(call.message.chat.id, open("some_image.jpg", "rb"))
P.S.
Error Environment:
- python==3.8.5
- pyTelegramBotAPI==3.7.3
- PIL==7.2.0
Added the field file_unique_id to the objects Animation, Audio, Document, PassportFile, PhotoSize, Sticker, Video, VideoNote, Voice, File and the fields small_file_unique_id and big_file_unique_id to the object ChatPhoto. (Bot API 4.5)
Initial beta of custom exception handler for poll mode.
Use ExceptionHandler class and bot.exception_handler to proceed unhandled exceptions in poll mode.
Replacing 1 exception class with 3 more specific classes:
HTTP Exception (server returned http code != 200),
Invalid JSON Exception (server returned invalid json),
Telegram Expection (telegram returned ok != true)
All 3 classes extend BaseApiException so we can handle all API exceptions at the same time
Added RETRY_ON_ERROR var. If its value is true, we'll try to get proper result MAX_RETRIES times, with RETRY_TIMEOUT delay between requests. Last request will be called outside of the try block, so it will throw an exception on failure
P.S.
I'm actually not sure if there are better ways to solve this problem, but this was my way of solving it