Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: Task got Future attached to a different loop #6

Open
Eikosa opened this issue Jun 11, 2022 · 2 comments
Open

RuntimeError: Task got Future attached to a different loop #6

Eikosa opened this issue Jun 11, 2022 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@Eikosa
Copy link
Contributor

Eikosa commented Jun 11, 2022

Task <Task pending name='Task-30' coro=<Dispatcher.handler_worker() running at /usr/local/lib/python3.8/dist-packages/pyrogram/dispatcher.py:240>> got Future <Future pending cb=[Client.clear_listener(5177820294)()]> attached to a different loop
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/pyrogram/dispatcher.py", line 240, in handler_worker
    await handler.callback(self.client, *args)
  File "/usr/local/lib/python3.8/dist-packages/pyromod/listen/listen.py", line 93, in resolve_listener
    await self.user_callback(client, message, *args)
  File "main.py", line 404, in me
    answer = await client.ask(5177820294, '/rehber')
  File "/usr/local/lib/python3.8/dist-packages/pyromod/listen/listen.py", line 60, in ask
    response = await self.listen(chat_id, filters, timeout)
  File "/usr/local/lib/python3.8/dist-packages/pyromod/listen/listen.py", line 55, in listen
    return await asyncio.wait_for(future, timeout)
  File "/usr/lib/python3.8/asyncio/tasks.py", line 455, in wait_for
    return await fut
RuntimeError: Task <Task pending name='Task-30' coro=<Dispatcher.handler_worker() running at /usr/local/lib/python3.8/dist-packages/pyrogram/dispatcher.py:240>> got Future <Future pending cb=[Client.clear_listener(5177820294)()]> attached to a different loop
@usernein usernein changed the title ask is not working RuntimeError: Task got Future attached to a different loop Oct 30, 2023
@usernein usernein added the help wanted Extra attention is needed label Oct 30, 2023
@FolcloreX
Copy link

FolcloreX commented Jul 17, 2024

Task <Task pending name='Task-31' coro=<MessageHandler.resolve_future_or_callback() running at /home/folclore/Programming/Python/TelegramBots/FileSaverBot/.venv/lib/python3.12/site-packages/pyromod/listen/message_handler.py:98> cb=[run_until_complete..done_cb()]> got Future <Future pending cb=[_chain_future.._call_check_cancel() at /usr/lib/python3.12/asyncio/futures.py:387]> attached to a different loop
Traceback (most recent call last):
File "/home/folclore/Programming/Python/TelegramBots/FileSaverBot/.venv/lib/python3.12/site-packages/pyrogram/dispatcher.py", line 242, in handler_worker
await self.loop.run_in_executor(
File "/usr/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/folclore/Programming/Python/TelegramBots/FileSaverBot/.venv/lib/python3.12/site-packages/pyrogram/sync.py", line 66, in async_to_sync_wrap
return loop.run_until_complete(coroutine)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
File "/home/folclore/Programming/Python/TelegramBots/FileSaverBot/.venv/lib/python3.12/site-packages/pyromod/listen/message_handler.py", line 98, in resolve_future_or_callback
await self.original_callback(client, message, *args)
File "/home/folclore/Programming/Python/TelegramBots/IndexBot/bot/plugins/commands.py", line 61, in credentials_command
await message.reply(
File "/home/folclore/Programming/Python/TelegramBots/FileSaverBot/.venv/lib/python3.12/site-packages/pyrogram/types/messages_and_media/message.py", line 970, in reply_text
return await self._client.send_message(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/folclore/Programming/Python/TelegramBots/FileSaverBot/.venv/lib/python3.12/site-packages/pyrogram/methods/messages/send_message.py", line 126, in send_message
r = await self.invoke(
^^^^^^^^^^^^^^^^^^
File "/home/folclore/Programming/Python/TelegramBots/FileSaverBot/.venv/lib/python3.12/site-packages/pyrogram/methods/advanced/invoke.py", line 79, in invoke
r = await self.session.invoke(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/folclore/Programming/Python/TelegramBots/FileSaverBot/.venv/lib/python3.12/site-packages/pyrogram/session/session.py", line 389, in invoke
return await self.send(query, timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/folclore/Programming/Python/TelegramBots/FileSaverBot/.venv/lib/python3.12/site-packages/pyrogram/session/session.py", line 326, in send
payload = await self.loop.run_in_executor(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Task <Task pending name='Task-31' coro=<MessageHandler.resolve_future_or_callback() running at /home/folclore/Programming/Python/TelegramBots/FileSaverBot/.venv/lib/python3.12/site-packages/pyromod/listen/message_handler.py:98> cb=[run_until_complete..done_cb()]> got Future <Future pending cb=[_chain_future.._call_check_cancel() at /usr/lib/python3.12/asyncio/futures.py:387]> attached to a different loop

Is it the same error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants
@Eikosa @usernein @FolcloreX and others