E
E
Emil Timerbaev2020-11-22 13:33:31
Python
Emil Timerbaev, 2020-11-22 13:33:31

Error while importing discord.ext?

I had a fully functional little program, but now when I run it, it gives me an error

Mistake
"C:\Program Files\Python38\python.exe" "D:/Emil Programm/Unibot/discord.py"
Traceback (most recent call last):
  File "D:/Emil Programm/Unibot/discord.py", line 1, in <module>
    import discord
  File "D:\Emil Programm\Unibot\discord.py", line 2, in <module>
    from discord.ext import commands
ModuleNotFoundError: No module named 'discord.ext'; 'discord' is not a package

Process finished with exit code 1

Here is the program:
import discord
from discord.ext import commands
from config import settings

bot = commands.Bot(command_prefix = settings['prefix'])

@bot.command()
async def hello(ctx):
    await ctx.send(f'Hello, {ctx.message.author.mention}!')

bot.run(settings['token'])

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2020-11-22
@MrDlop

Rename your file. It is named like the library you are importing

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question