'ImportError: cannot import name 'InvalidArgument' from 'discord'

I have, in recent days, been trying to get the packages right in my code. Now, another error arose, and I'm unsure how to fix it. But I think it might have something to do with the package versions I have installed.

I am using discord_slash for my code. It says that discord cannot import the name 'InvalidArgument,' and I'm not sure why.

Here's the log code:

Traceback (most recent call last):
  File "c:/Users/golle/Desktop/Discord/Bots/My bot/Bot code/client.py", line 11, in <module>
    from discord_components import DiscordComponents, Button, ButtonStyle, InteractionEventType, ComponentsBot
  File "C:\Python\Python38\lib\site-packages\discord_components\__init__.py", line 1, in <module>
    from .client import *
  File "C:\Python\Python38\lib\site-packages\discord_components\client.py", line 12, in <module>
    from .component import Component
  File "C:\Python\Python38\lib\site-packages\discord_components\component.py", line 3, in <module>
    from discord import PartialEmoji, Emoji, InvalidArgument
ImportError: cannot import name 'InvalidArgument' from 'discord' (C:\Python\Python38\lib\site-packages\discord\__init__.py)
PS C:\Users\golle\Desktop\Discord\The Therapy Center\TTC Bot\Bot code> & C:/Python/Python38/python.exe "c:/Users/golle/Desktop/Discord/The Therapy Center/TTC Bot/Bot code/client.py"
Traceback (most recent call last):
  File "c:/Users/golle/Desktop/Discord/The Therapy Center/TTC Bot/Bot code/client.py", line 8, in <module>
    from discord_slash import SlashCommand, SlashContext
  File "C:\Python\Python38\lib\site-packages\discord_slash\__init__.py", line 9, in <module>
    from .client import SlashCommand  # noqa: F401
  File "C:\Python\Python38\lib\site-packages\discord_slash\client.py", line 12, in <module>
    from . import context, error, http, model
  File "C:\Python\Python38\lib\site-packages\discord_slash\context.py", line 10, in <module>
    from . import error, http, model
  File "C:\Python\Python38\lib\site-packages\discord_slash\model.py", line 12, in <module>
    from .dpy_overrides import ComponentMessage
  File "C:\Python\Python38\lib\site-packages\discord_slash\dpy_overrides.py", line 4, in <module>
    from discord import AllowedMentions, File, InvalidArgument, abc, http, utils
ImportError: cannot import name 'InvalidArgument' from 'discord' (C:\Python\Python38\lib\site-packages\discord\__init__.py)

I have never had this issue before, and it just now became apparent after I installed another version of discord.py.

What can I do about this?

Thanks beforehand.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source