Skip to content
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

!load <cog> crashes #2686

Closed
Drapersniper opened this issue May 16, 2019 · 0 comments · Fixed by #2688
Closed

!load <cog> crashes #2686

Drapersniper opened this issue May 16, 2019 · 0 comments · Fixed by #2688
Assignees
Labels
Status: In Progress There's a PR open to deal with this, or an org member is working on this internally Type: Bug Unexpected behavior, result, or exception. In case of PRs, it is a fix for the foregoing.

Comments

@Drapersniper
Copy link
Contributor

Tried to load a cog and getting an error on self._call_module_finalizers(lib, key) as "key" is not defined in https://github.com/Cog-Creators/Red-DiscordBot/blob/V3/develop/redbot/core/bot.py, line 256 : NameError: name 'key' is not defined

async def load_extension(self, spec: ModuleSpec):
    # NB: this completely bypasses `discord.ext.commands.Bot._load_from_module_spec`
    name = spec.name.split(".")[-1]
    if name in self.extensions:
        raise errors.PackageAlreadyLoaded(spec)

    lib = spec.loader.load_module()
    if not hasattr(lib, "setup"):
        del lib
        raise discord.ClientException(f"extension {name} does not have a setup function")

    try:
        if asyncio.iscoroutinefunction(lib.setup):
            await lib.setup(self)
        else:
            lib.setup(self)
    except Exception as e:
        self._remove_module_references(lib.__name__)
        self._call_module_finalizers(lib, key)
        raise errors.ExtensionFailed(key, e) from e
    else:
        self._BotBase__extensions[name] = lib
@Drapersniper Drapersniper changed the title !load Cog !load <cog> crashes May 16, 2019
@mikeshardmind mikeshardmind self-assigned this May 16, 2019
@mikeshardmind mikeshardmind added Type: Bug Unexpected behavior, result, or exception. In case of PRs, it is a fix for the foregoing. Status: In Progress There's a PR open to deal with this, or an org member is working on this internally labels May 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: In Progress There's a PR open to deal with this, or an org member is working on this internally Type: Bug Unexpected behavior, result, or exception. In case of PRs, it is a fix for the foregoing.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants