I have problem when try run simple async func in aioschedule and aiogram I use Apple M1
import aioschedule
from aiogram import Bot, Dispatcher, executor, types
TOKEN = 'token here'
bot = Bot(TOKEN)
dp = Dispatcher(bot)
async def hello():
print('Hello World')
async def scheduler():
"""Планувальник задач"""
try:
aioschedule.every().minute.do(hello)
while True:
await aioschedule.run_pending()
await asyncio.sleep(5)
except Exception as error:
logger.error(error)
async def on_startup(_):
"""Запуск планувальника задач при старті бота"""
asyncio.create_task(scheduler())
logger.info('TelegramBot running...')
if __name__ == '__main__':
try:
executor.start_polling(dp, skip_updates=True, on_startup=on_startup)
except Exception as err:
logger.error(err)
After launching sheduler
is started but when it launch func hello
raise error
2023-03-17 16:18:15,076 [ERROR] - __main__ - scheduler(180) - Passing coroutines is forbidden, use tasks explicitly.
/Users/emojiestore/programs/GitHub/Health-KPI/telegram_service/main.py:180: RuntimeWarning: coroutine 'Job.run' was never awaited
logger.error(error)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
But when I run this code on my old MacBook on Intel - all work correct