편집 기록

편집 기록
  • 프로필 nowp님의 편집
    날짜2021.03.30

    asyncio event loop is closed 에러가 뜹니다


    현재 사용하고 있는 버전은 python - 3.9.2 입니다.

    제가 discord.py 를 이용해서 봇을 만들고 있는데 실행시킬때마다

    Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x0000017C8787EC10>
    Traceback (most recent call last):
      File "C:\Users\sooch\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
        self.close()
      File "C:\Users\sooch\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close
        self._loop.call_soon(self._call_connection_lost, None)
      File "C:\Users\sooch\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 746, in call_soon
        self._check_closed()
      File "C:\Users\sooch\AppData\Local\Programs\Python\Python39\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 0x0000017C8787EC10>
    Traceback (most recent call last):
      File "C:\Users\sooch\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
      File "C:\Users\sooch\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close
      File "C:\Users\sooch\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 746, in call_soon
      File "C:\Users\sooch\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
    RuntimeError: Event loop is closed
    

    이런 에러가 뜹니다.

    구글링을 해보긴 했지만 거의 외국의 사례라 언어의 장벽 때문에 난항을 겪고 있습니다.

    혹시 어느 부분이 잘못됬는지. 어떻게 하면 고칠 수 있는지 알려주실 수 있나요?

    Code

    import discord
    import asyncio
    from discord.ext import commands
    
    
    INTENTS = discord.Intents.all()
    client = commands.Bot(command_prefix = '!', intents=INTENTS)
    
    @client.event
    async def on_ready():
        print('Bot is ready')
    
    @client.command()
    async def ping(ctx):
        await ctx.send(f'Pong! `{round(client.latency * 1000)}ms`')
    
    
    client.run('TOKEN')
    
  • 프로필 Include님의 편집
    날짜2021.03.29

    asyncio event loop is closed 에러가 뜹니다


    현재 사용하고 있는 버전은 python - 3.9.2 입니다.

    제가 discord.py 를 이용해서 봇을 만들고 있는데 실행시킬때마다

    Exception ignored in: Traceback (most recent call last): File "C:\Users\sooch\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 116, in del self.close() File "C:\Users\sooch\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close self.loop.call_soon(self._call_connection_lost, None) File "C:\Users\sooch\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 746, in call_soon self._check_closed() File "C:\Users\sooch\AppData\Local\Programs\Python\Python39\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 0x0000017C8787EC10> Traceback (most recent call last): File "C:\Users\sooch\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 116, in del File "C:\Users\sooch\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close File "C:\Users\sooch\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 746, in call_soon File "C:\Users\sooch\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 510, in _check_closed RuntimeError: Event loop is closed

    이런 에러가 뜹니다.

    구글링을 해보긴 했지만 거의 외국의 사례라 언어의 장벽 때문에 난항을 겪고 있습니다.

    혹시 어느 부분이 잘못됬는지. 어떻게 하면 고칠 수 있는지 알려주실 수 있나요?

    Code

    import discord
    import asyncio
    from discord.ext import commands
    
    
    INTENTS = discord.Intents.all()
    client = commands.Bot(command_prefix = '!', intents=INTENTS)
    
    @client.event
    async def on_ready():
        print('Bot is ready')
    
    @client.command()
    async def ping(ctx):
        await ctx.send(f'Pong! `{round(client.latency * 1000)}ms`')
    
    
    client.run('TOKEN')