Skip to content

NameError: name 'Guild' is not defined #848

@ossenthusiast

Description

@ossenthusiast

Summary

Guild not imported in str

Reproduction Steps

  • Call str on instance of discord.GuildFolder:
str(guild_folder)

I added: from .guild import Guild in __str__ and it worked after that.

Code

Code:

class MyClient(discord.Client):
    async def on_ready(self) -> None:
        assert(self.settings)
        for folder in self.settings.guild_folders:
            print(str(folder))

Error:

NameError: name 'Guild' is not defined1196def __str__(self) -> str:                                                                                                                                                                                                                                           │
│ ❱ 1197 │   │   return self.name or ', '.join(guild.name for guild in [guild for guild in self.g

Expected Results

Return str representation of GuildFolder.

Actual Results

N/A

System Information

N/A

Checklist

  • I have confirmed I am using unmodified discord.py-self and not the upstream discord.py.
  • I am using a user token (and it isn't visible in the code).
  • I have searched the open issues for duplicates.
  • I have searched closed issues for resolved duplicates.
  • I have confirmed the development version doesn't resolve the issue.
  • I have shared the entire traceback.

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions