Getting a runTime error while trying to reload cogs? #6019
-
This is the code for the reload function I'm creating:
however when I type "$reload all" it gives me "RuntimeError: dictionary keys changed during iteration". When I type "$reload all" again it works, and this repeats over and over again, does anyone know why this is happening? I'm using VS code to run the code. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
The problem lines here are: for extension in extensions:
self.bot.reload_extension(extension) Bot.extensions is a mapping and mappings cannot be modified during iteration. You should modify the above lines to create a copy of the bot's extensions mapping before iteration. |
Beta Was this translation helpful? Give feedback.
-
Its working perfectly, thanks! |
Beta Was this translation helpful? Give feedback.
The problem lines here are:
Bot.extensions is a mapping and mappings cannot be modified during iteration.
You should modify the above lines to create a copy of the bot's extensions mapping before iteration.