'My discord.py bot is not starting because of a KeyError
With the following code that I have for my bot, he's not booting up. I don't understand.
Here is my code (I have put a mystb.in link, because my question had "too much code")
The full traceback:
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x0000000004005D30>
Traceback (most recent call last):
File "C:\Users\Bi\AppData\Local\Programs\Python\Python38\lib\asyncio\proactor_events.py", line 116, in __del__
self.close()
File "C:\Users\Bi\AppData\Local\Programs\Python\Python38\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "C:\Users\Bi\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 711, in call_soon
self._check_closed()
File "C:\Users\Bi\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 504, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
And here is the image of what the error shows up like in VSCode.
There is something that I don't understand very well, when I put in a different token it works just perfectly fine.
Solution 1:[1]
It seems to me that the problem lies in reading from the config file in main at lines 6-13. Make sure that in config.json you have all the variables you're trying to get and it gets them correctly.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Nimantha |
