@Linar139

Ошибка PythonAnywhere?

написал тг бота на threading и asyncio
код выдает ошибку в pythonanywhere, когда в windows все работает

home/.../main.py:22: DeprecationWarning: There is no current event loop
  self.loop1 = asyncio.get_event_loop()
Task exception was never retrieved
future: <Task finished name='Task-1' coro=<Bots.start.<locals>.tg_event.<locals>.tg_start() done, defined at /home/.../main.py:50> exception=RuntimeError('set_wakeup_fd only works in main thread of the main interpreter')>
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/unix_events.py", line 105, in add_signal_handler
    signal.set_wakeup_fd(self._csock.fileno())
ValueError: set_wakeup_fd only works in main thread of the main interpreter

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/.../main.py", line 51, in tg_start
    await self.dp.start_polling(self.bot)
  File "/home/.../.local/lib/python3.10/site-packages/aiogram/dispatcher/dispatcher.py", line 510, in start_polling
    loop.add_signal_handler(
  File "/usr/local/lib/python3.10/asyncio/unix_events.py", line 107, in add_signal_handler
    raise RuntimeError(str(exc))
RuntimeError: set_wakeup_fd only works in main thread of the main interpreter
  • Вопрос задан
  • 113 просмотров
Решения вопроса 1
sergey-gornostaev
@sergey-gornostaev Куратор тега Python
Седой и строгий
на threading и asyncio

Нет, это ошибка не PythonAnywhere, а ваша. Не стоит смешивать многопоточность и асинхронность.
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

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

Войти через центр авторизации
Похожие вопросы