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

[Downloader] [p]findcog doesn't work if cog class is at different level than cog_folder/ #3177

jack1142 opened this issue Dec 8, 2019 · 0 comments · Fixed by #3178
Type: Bug


Copy link

@jack1142 jack1142 commented Dec 8, 2019

Command bugs

Command name


What cog is this command from?


What were you expecting to happen?

Get cog the command is from

What actually happened?

Got error:

[2019-12-08 23:17:40] [ERROR] red: Exception in command 'findcog'
Traceback (most recent call last):
  File "venv\lib\site-packages\discord\ext\commands\", line 79, in wrapped
    ret = await coro(*args, **kwargs)
  File "venv\lib\site-packages\redbot\cogs\downloader\", line 1199, in findcog
    cog_name = self.cog_name_from_instance(cog)
  File "venv\lib\site-packages\redbot\cogs\downloader\", line 1182, in cog_name_from_instance
    return splitted[-2]
IndexError: list index out of range

How can we reproduce this issue?

  1. Create a cog with cog class placed in
  2. Load the cog.
  3. Use [p]findcog command_from_that_cog
  4. See error

In short, it looks like Downloader.cog_name_from_instance heavily relies on most common file structure in cogs where you have cog class in cog_folder/ file and it raises if it's in cog_folder/ and also determines wrong cog name if it's placed in cog_folder/subpackage/

@jack1142 jack1142 added the Type: Bug label Dec 8, 2019
@jack1142 jack1142 changed the title [Downloader] `[p]findcog [Downloader] [p]findcog doesn't work if cog class is at different level than cog_folder/ Dec 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Type: Bug
None yet

Successfully merging a pull request may close this issue.

1 participant