Closed tanner02 closed 2 years ago
Please don't use v1.10-alpha. Try installing from the rebase branch (v2.0), that fixes the issue.
The problem still persists on discord.py-self-2.0.0a1
It's also a bit different on my local machine:
from discord.ext import commands, tasks
ImportError: cannot import name 'commands' from 'discord.ext' (unknown location)
I'll take another look.
Issue still exists for me as well
There is no __init__.py
file in discord.ext
folder so how is it imported? I don't have discord.py
installed at the same time, because it gives me more errors about no AutoShardedBot
.
Same problem. Updated the rebase branch. Before changes #16ad1a1 worked.
Through trial and error, I found the last working commit on this issue #6420dfd Everyone after this commit has this error
Interesting.
There is no
__init__.py
file indiscord.ext
folder so how is it imported? I don't havediscord.py
installed at the same time, because it gives me more errors about noAutoShardedBot
.
AutoShardedBot doesn't exist because users do not shard.
I installed the rebase
branch using pip install git+https://github.com/dolfies/discord.py-self.git@rebase
. This is the discord
package directory:
.../site-packages/discord$ ls --color
abc.py emoji.py mentions.py role.py
activity.py enums.py message.py settings.py
appinfo.py errors.py mixins.py stage_instance.py
asset.py file.py object.py state.py
audit_logs.py flags.py oggparse.py sticker.py
backoff.py gateway.py opus.py team.py
bin guild_folder.py partial_emoji.py template.py
calls.py guild.py permissions.py threads.py
channel.py http.py player.py tracking.py
client.py __init__.py profile.py types
colour.py integrations.py __pycache__ user.py
commands.py interactions.py py.typed utils.py
components.py invite.py raw_models.py voice_client.py
connections.py iterators.py reaction.py webhook
context_managers.py __main__.py recorder.py welcome_screen.py
embeds.py member.py relationship.py widget.py
I don't see the ext/
folder anywhere.
Ah, i see what is going wrong. Without __init__.py
in discord/ext/
, setuptools.find_packages()
doesn't recognise discord.ext
as a subpackage and doesn't include it in the installation. Maybe adding an empty __init__.py
file would fix it?
Works perfectly with an extra __init__.py
file. (other than issue #180)
Not having an extra __init__.py
is deliberate. discord.ext.*
shouldn't be imported when you simply import discord
, especially since external libs use that namespace.
Should be good now.
Summary
Doesn't find discord.ext module
Reproduction Steps
import discord from discord.ext import commands, tasks
Code
Expected Results
find the module
Actual Results
not finding the module for some reason
System Information
Checklist
Additional Information
No response