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

Fix circular import #3

Merged
merged 1 commit into from Aug 29, 2021
Merged

Fix circular import #3

merged 1 commit into from Aug 29, 2021

Conversation

1oonie
Copy link
Contributor

@1oonie 1oonie commented Aug 29, 2021

Summary

This PR fixes a circular import issue that came from importing _BaseCommand from the _types.py file.

For reference, this is what used to happen:

Python 3.9.6 (default, Aug 23 2021, 19:43:03) 
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import discord.bot
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/esmecat/pycord/discord/__init__.py", line 62, in <module>
    from .bot import *
  File "/home/esmecat/pycord/discord/bot.py", line 28, in <module>
    from .ext.commands._types import _BaseCommand
  File "/home/esmecat/pycord/discord/ext/commands/__init__.py", line 11, in <module>
    from .bot import *
  File "/home/esmecat/pycord/discord/ext/commands/bot.py", line 1036, in <module>
    class Bot(BotBase, discord.Bot):
AttributeError: partially initialized module 'discord' has no attribute 'Bot' (most likely due to a circular import)

I am not sure why this import was here in the first place (so I could be wrong in removing it) so please point this out to me if I am incorrect.

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)

@Dorukyum
Copy link
Member

This doesn't solve the issue as it is at the moment.

@1oonie
Copy link
Contributor Author

1oonie commented Aug 29, 2021

It seemed to solve it for me but I'll close this anyways.

@1oonie 1oonie closed this Aug 29, 2021
@Dorukyum
Copy link
Member

My bad, I tested it incorrectly.

@Dorukyum Dorukyum reopened this Aug 29, 2021
@CodeWithSwastik CodeWithSwastik merged commit 2bd2443 into Pycord-Development:slash Aug 29, 2021
BobDotCom added a commit that referenced this pull request Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants