Python 3.14 compatibility: asyncio event loop error on bot startup #37
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Bot crashes on startup with Python 3.14:
Root Cause
In Python 3.10+,
asyncio.get_event_loop()was deprecated in the main thread (it created one implicitly but with a warning). In Python 3.14, it now raisesRuntimeErrorinstead of creating one implicitly.The telegram library's
app.run_polling()internally callsasyncio.get_event_loop()to schedule async tasks, but in Python 3.14 there's no event loop in the main thread by default.Current Fix (bot.py)
Better Fix (upstream)
Consider using
asyncio.run()pattern instead:This avoids the manual event loop management entirely and is the recommended pattern for modern asyncio code.
Status
apps/telegram-bot/bot.pyLabels
bug(python 3.14 compatibility)telegram-bot