-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bug with ?plugin update
.
#3295
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback: Traceback (most recent call last):
File "/User/Projects/modmail/cogs/plugins.py", line 259, in load_plugin
await self.bot.load_extension(plugin.ext_string)
File "/User/Projects/modmail/.venv/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 1012, in load_extension
await self._load_from_module_spec(spec, name)
File "/User/Projects/modmail/.venv/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 937, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension '[email protected]' raised an error: SyntaxError: invalid syntax (supportutils.py, line 22)
2023-07-22 14:55:42 __main__[1531] - ERROR: Unexpected exception:
Traceback (most recent call last):
File "/User/Projects/modmail/.venv/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 934, in _load_from_module_spec
spec.loader.exec_module(lib) # type: ignore
File "<frozen importlib._bootstrap_external>", line 846, in exec_module
File "<frozen importlib._bootstrap_external>", line 983, in get_code
File "<frozen importlib._bootstrap_external>", line 913, in source_to_code
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/User/Projects/modmail/plugins/@local/supportutils/supportutils.py", line 22
.
^
SyntaxError: invalid syntax
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/User/Projects/modmail/cogs/plugins.py", line 259, in load_plugin
await self.bot.load_extension(plugin.ext_string)
File "/User/Projects/modmail/.venv/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 1012, in load_extension
await self._load_from_module_spec(spec, name)
File "/User/Projects/modmail/.venv/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 937, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension '[email protected]' raised an error: SyntaxError: invalid syntax (supportutils.py, line 22)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/User/Projects/modmail/cogs/plugins.py", line 499, in update_plugin
await self.load_plugin(plugin)
File "/User/Projects/modmail/cogs/plugins.py", line 265, in load_plugin
raise InvalidPluginError("Cannot load extension, plugin invalid.") from exc
cogs.plugins.InvalidPluginError: Cannot load extension, plugin invalid.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/User/Projects/modmail/.venv/lib/python3.9/site-packages/discord/ext/commands/core.py", line 190, in wrapped
ret = await coro(*args, **kwargs)
File "/User/Projects/modmail/cogs/plugins.py", line 530, in plugins_update
await self.update_plugin(ctx, plugin_name)
File "/User/Projects/modmail/cogs/plugins.py", line 505, in update_plugin
self.bot.config["plugins"].remove(plugin_name)
ValueError: list.remove(x): x not in list
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/User/Projects/modmail/.venv/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 1347, in invoke
await ctx.command.invoke(ctx)
File "/User/Projects/modmail/.venv/lib/python3.9/site-packages/discord/ext/commands/core.py", line 1605, in invoke
await ctx.invoked_subcommand.invoke(ctx)
File "/User/Projects/modmail/.venv/lib/python3.9/site-packages/discord/ext/commands/core.py", line 986, in invoke
await injected(*ctx.args, **ctx.kwargs) # type: ignore
File "/User/Projects/modmail/.venv/lib/python3.9/site-packages/discord/ext/commands/core.py", line 199, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ValueError: list.remove(x): x not in list This occured when I used command This is the part that we want to solve: self.bot.config["plugins"].remove(plugin_name)
ValueError: list.remove(x): x not in list Because of this error, the bot fails to remove the plugin from config. |
Taaku18
approved these changes
Nov 19, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will be implemented for the next update, thanks!
Merged
raidensakura
pushed a commit
to raidensakura/modmail
that referenced
this pull request
Apr 10, 2024
khakers
pushed a commit
to khakers/OpenModmail
that referenced
this pull request
Jun 18, 2024
(cherry picked from commit a94e7a9) Signed-off-by: Khakers <[email protected]>
khakers
pushed a commit
to khakers/OpenModmail
that referenced
this pull request
Jun 18, 2024
(cherry picked from commit a94e7a9) Signed-off-by: Khakers <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes bug occured when running
?plugin update
command and only if the updated plugin is broken.