Event loop is closed.Called after closing the discord bot
Hello everyone. There is a rather unusual problem. I wrote a discord bot. It functions calmly and processes requests. But there is one moment. After completion (shutdown) the bot gives an error. Error:
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x000001ED5B3B1F30> Traceback (most recent call last): File "C:\Users\Семён Орехов\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 116, in __del__ self.close() File "C:\Users\Семён Орехов\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 108, in close self._loop.call_soon(self._call_connection_lost, None) File "C:\Users\Семён Орехов\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 745, in call_soon self._check_closed() File "C:\Users\Семён Орехов\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 510, in _check_closed raise RuntimeError('Event loop is closed') RuntimeError: Event loop is closed Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x000001ED5B3B1F30> Traceback (most recent call last): File "C:\Users\Семен Орехов\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 116, in __del__ File "C:\Users\Семён Орехов\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 108, in close File "C:\Users\Семён Орехов\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 745, in call_soon File "C:\Users\Семён Орехов\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 510, in _check_closed RuntimeError: Event loop is closed
The bot issues such an error after the program is completed. How to fix it?
Solutions like:
- change token
- token is invalid
These solutions didn't help me.
The only thing I have improved all the libraries that were. Discord itself, aiohttp and asyncio. But they did not lead to a result. What can such a problem be related to? Bot code, example:
import discord
TOKEN = 'token'
class MyClient(discord.Client):
async def on_ready(self):
print('Logged on as', self.user)
async def on_message(self, message):
# don't respond to ourselves
if message.author == self.user:
return
if message.content == 'ping':
await message.channel.send('pong')
client = MyClient()
client.run(TOKEN)
1
-
I have the same problem. Did you find a avoid this?
0
Vous devez vous connecter pour laisser un commentaire.
Commentaires
1 commentaire