DanialHMD · GitHub

Steps to Reproduce

  1. Created the bot and run the code below:
import asyncio
import telegram
async def main():
    bot = telegram.Bot("TOKEN")
    async with bot:
        print(await bot.get_me())
if __name__ == '__main__':
    asyncio.run(main())
  1. Added a new file and run the code below:
import logging
from telegram import Update
from telegram.ext import ApplicationBuilder, ContextTypes, CommandHandler
logging.basicConfig(
    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
    level=logging.INFO
)
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
    await   context.bot.send_message(chat_id= update.effective_chat.id, text="Bot Started.")
if __name__=="__main__":
    application= ApplicationBuilder().token("6900324258:AAEMo7fMCqGE816sPd30-Jmsiw1P5jgpKHA").build()
    start_handler= CommandHandler("start", start)
    application.add_handler(start_handler)
    application.run_polling()

Expected behaviour

There shouldn't be any errors or problems.

Actual behaviour

Raised attribute_error. Log sent on Log output.

Operating System

windows 10

Version of Python, python-telegram-bot & dependencies

python-telegram-bot 20.8
Bot API 7.0
Python 3.13.0a2 (tags/v3.13.0a2:9c4347e, Nov 22 2023, 18:30:15) [MSC v.1937 64 bit (AMD64)]

Relevant log output

File "f:\Codes\Python\Telegram_Bot\main.py", line 15, in <module>
    application= ApplicationBuilder().token(token).build()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\Programs\Python\Python313\Lib\site-packages\telegram\ext\_applicationbuilder.py", line 312, in build
    updater = Updater(bot=bot, update_queue=update_queue)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\Programs\Python\Python313\Lib\site-packages\telegram\ext\_updater.py", line 128, in __init__
    self.__polling_cleanup_cb: Optional[Callable[[], Coroutine[Any, Any, None]]] = None
    ^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Updater' object has no attribute '_Updater__polling_cleanup_cb' and no __dict__ for setting new attributes

Additional Context

No response

Read the original on github.com ↗