Error, async_.py
Summary
It tries to import https://github.com/Pycord-Development/pycord/blob/6d30c5b7764ff87f3102ddef32c656f463b26132/discord/channel.py#L2033 in file https://github.com/Pycord-Development/pycord/blob/master/discord/webhook/async_.py#L46
Reproduction Steps
I ran my bot,
python3.9 MinecraftBot.py
Minimal Reproducible Code
import json, requests, discord, asyncio, time, itertools, os, topgg
Expected Results
Everything to run smoothly and the Slash commands to be working.
Actual Results
Traceback (most recent call last):
File "/home/quartz_i_warrior/MinecraftBot.py", line 1, in <module>
import json, requests, discord, asyncio, time, itertools, os, topgg
File "/home/quartz_i_warrior/.local/lib/python3.9/site-packages/discord/__init__.py", line 25, in <module>
from .client import Client
File "/home/quartz_i_warrior/.local/lib/python3.9/site-packages/discord/client.py", line 53, in <module>
from .webhook import Webhook
File "/home/quartz_i_warrior/.local/lib/python3.9/site-packages/discord/webhook/__init__.py", line 12, in <module>
from .async_ import *
File "/home/quartz_i_warrior/.local/lib/python3.9/site-packages/discord/webhook/async_.py", line 46, in <module>
from ..channel import PartialMessageable
ImportError: cannot import name 'PartialMessageable' from 'discord.channel' (/home/quartz_i_warrior/.local/lib/python3.9/site-packages/discord/channel.py)
Intents
None.
System Information
- Python v3.9.7-final
- discord.py v1.7.3-final
- aiohttp v3.7.4.post0
- system info: Linux 4.19.0-17-cloud-amd64 #1 SMP Debian 4.19.194-2 (2021-06-21)
Checklist
- [X] I have searched the open issues for duplicates.
- [X] I have shown the entire traceback, if possible.
- [X] I have removed my token from display, if visible.
Additional Context
Cannot reproduce...this is an installation error please uninstall py-cord and reinstall from git
pip uninstall py-cord
pip install -U git+https://github.com/Pycord-Development/pycord
hmmm ok, I had done:
git clone https://github.com/Pycord-Development/pycord
cd pycord
python3.9 -m pip -U install .
and I re-installed it and uninstalled it multiple times in hopes of fixing it.
Was the way I did it bad or something? Thanks.
No, but did you uninstall discord.py first?
pip uninstall discord.py -y
Yes, but I forgot the - y part
It doesn't matter, -y is just a shortcut flag that will auto-confirm uninstallation.
Still getting the same error:
Traceback (most recent call last):
File "/home/quartz_i_warrior/MinecraftBot.py", line 3, in <module>
from discord.ext import commands, tasks
File "/home/quartz_i_warrior/.local/lib/python3.9/site-packages/discord/__init__.py", line 25, in <module>
from .client import Client
File "/home/quartz_i_warrior/.local/lib/python3.9/site-packages/discord/client.py", line 53, in <module>
from .webhook import Webhook
File "/home/quartz_i_warrior/.local/lib/python3.9/site-packages/discord/webhook/__init__.py", line 12, in <module>
from .async_ import *
File "/home/quartz_i_warrior/.local/lib/python3.9/site-packages/discord/webhook/async_.py", line 46, in <module>
from ..channel import PartialMessageable
ImportError: cannot import name 'PartialMessageable' from 'discord.channel' (/home/quartz_i_warrior/.local/lib/python3.9/site-packages/discord/channel.py)
Ok, I just installed wheel then reinstalled py-cord, cause it turned out I didn't have it, but now am getting this error:
Traceback (most recent call last):
File "/home/quartz_i_warrior/.local/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 660, in _load_from_module_spec
spec.loader.exec_module(lib) # type: ignore
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/home/quartz_i_warrior/Moderation.py", line 4, in <module>
from discord.ext.commands.errors import ExtensionNotFound, ExtensionNotLoaded, MissingPermissions
ImportError: cannot import name 'ExtensionNotFound' from 'discord.ext.commands.errors' (/home/quartz_i_warrior/.local/lib/python3.9/site-packages/discord/ext/commands/errors.py)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/quartz_i_warrior/MinecraftBot.py", line 158, in <module>
client.load_extension(cog)
File "/home/quartz_i_warrior/.local/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 732, in load_extension
self._load_from_module_spec(spec, name)
File "/home/quartz_i_warrior/.local/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 663, in _load_from_module_spec
raise discord.ExtensionFailed(key, e) from e
discord.errors.ExtensionFailed: Extension 'Moderation' raised an error: ImportError: cannot import name 'ExtensionNotFound' from 'discord.ext.commands.errors' (/home/quartz_i_warrior/.local/lib/python3.9/site-packages/discord/ext/commands/errors.py)
Just a note, the stable version of py-cord works.
The extension errors were moved in 7c4b4933fe9a091d1cdc5bc7214dc2b5de9191c9
hmm how do I replace those then?
nvm
Well they were moved to discord.errors so I guess you import then from there instead.
So, is there an easy way to transfer all these discord.py files to py-cord?
Also, is there a different method for importing from discord.ext import commands, tasks now?
Because the error starts with
Traceback (most recent call last):
File "/home/quartz_i_warrior/MinecraftBot.py", line 3, in <module>
from discord.ext import commands, tasks
Yep, getting the same error
Traceback (most recent call last):
File "/Users/nimboss/Desktop/Programming/Discord Bots/GitHub Utils/githubutils.py", line 1, in <module>
from discord.ext.commands import Bot
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/__init__.py", line 25, in <module>
from .client import Client
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/client.py", line 53, in <module>
from .webhook import Webhook
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/webhook/__init__.py", line 12, in <module>
from .async_ import *
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/webhook/async_.py", line 46, in <module>
from ..channel import PartialMessageable
ImportError: cannot import name 'PartialMessageable' from 'discord.channel' (/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/channel.py)
My installation's from git
Update: uninstalling and reinstalling worked for me
@QuartzWarrior could you try reinstalling?
I have done that multiple times... But yes, I could try again.
Traceback (most recent call last):
File "/home/quartz_i_warrior/.local/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 660, in _load_from_module_spec
spec.loader.exec_module(lib) # type: ignore
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/home/quartz_i_warrior/Moderation.py", line 4, in <module>
from discord.errors import ExtensionNotFound, ExtensionNotLoaded, MissingPermissions
ImportError: cannot import name 'MissingPermissions' from 'discord.errors' (/home/quartz_i_warrior/.local/lib/python3.9/site-packages/discord/errors.py)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/quartz_i_warrior/MinecraftBot.py", line 158, in <module>
client.load_extension(cog)
File "/home/quartz_i_warrior/.local/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 732, in load_extension
self._load_from_module_spec(spec, name)
File "/home/quartz_i_warrior/.local/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 663, in _load_from_module_spec
raise discord.ExtensionFailed(key, e) from e
discord.errors.ExtensionFailed: Extension 'Moderation' raised an error: ImportError: cannot import name 'MissingPermissions' from 'discord.errors' (/home/quartz_i_warrior/.local/lib/python3.9/site-packages/discord/errors.py)
File "/home/quartz_i_warrior/Moderation.py"
This problem is related to your code as I understood.
Yes, but if I go to the errors page, it shows that it is not there.