@Vadim_000

Бот выдает ошибку при смене версии python. Что нужно поменять?

import logging
import asyncio

from aiogram import Bot, Dispatcher
from aiogram.enums.parse_mode import ParseMode
from aiogram.fsm.storage.memory import MemoryStorage

from states import bot_mailing, calcul
import config
import handlers


async def main():
    bot = Bot(token=config.BOT_TOKEN, parse_mode=ParseMode.HTML)
    dp = Dispatcher(storage=MemoryStorage())
    dp.include_routers(handlers.router, bot_mailing.router, calcul.router)
    await bot.delete_webhook(drop_pending_updates=True)
    await dp.start_polling(bot, allowed_updates=dp.resolve_used_update_types())


if __name__ == '__main__':
    logging.basicConfig(level=logging.INFO)
     asyncio.run(main())

Поменял
asyncio.run(main())
На
asyncio.get_event_loop().run_until_complete(main())

Выдает ошибку
Traceback (most recent call last):
  File "C:\Users\Vadim\PycharmProjects\LunaBot\main.py", line 23, in <module>
    asyncio.get_event_loop().run_until_complete(main())
  File "C:\Users\Vadim\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 634, in run_until_complete
    self.run_forever()
  File "C:\Users\Vadim\AppData\Local\Programs\Python\Python39\lib\asyncio\windows_events.py", line 321, in run_forever
    super().run_forever()
  File "C:\Users\Vadim\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 601, in run_forever
    self._run_once()
  File "C:\Users\Vadim\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1869, in _run_once
    event_list = self._selector.select(timeout)
  File "C:\Users\Vadim\AppData\Local\Programs\Python\Python39\lib\asyncio\windows_events.py", line 439, in select
    self._poll(timeout)
  File "C:\Users\Vadim\AppData\Local\Programs\Python\Python39\lib\asyncio\windows_events.py", line 788, in _poll
    status = _overlapped.GetQueuedCompletionStatus(self._iocp, ms)
KeyboardInterrupt

Process finished with exit code -1073741510 (0xC000013A: interrupted by Ctrl+C)
  • Вопрос задан
  • 47 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы