Skip to content Skip to sidebar Skip to footer

(python) Discord Bot Code Returns "runtimeerror: Cannot Close A Running Event Loop"

I was trying to create code in Spyder to start my discord bot, but I encountered the following error: Traceback (most recent call last): File '', line 1, in runfile('C:/Users/Nath

Solution 1:

(Spyder maintainer here) In order to run async code in Spyder, you need to install a package called nest-asyncio and add these two lines to be the first ones in your code:

import nest_asyncio
nest_asyncio.apply()

Solution 2:

I found the solution. Instead of using Spyder's built-in console I used the command prompt to run my code, and this bypassed the RuntimeError.

Post a Comment for "(python) Discord Bot Code Returns "runtimeerror: Cannot Close A Running Event Loop""