Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error importing package
#1
import discord
from discord.ext import commands

client = commands.Bot(command_prefix= '.')

Token = 'a valid token'

@client.event
async def on_ready():
    print('bot is ready.')

client.run(Token)
Error:
Traceback (most recent call last): File "the location of the file", line 2, in <module> from discord.ext import commands ModuleNotFoundError: No module named 'discord.ext'; 'discord' is not a package
I keep getting this error all of a sudden. An hour ago it was still working but now it just keeps on giving me this error. Has anyone got an idea why I get this error?

Thanks in advance!
Reply
#2
do you have a file named discord.py? i.e. some file created by you around the time it stopped working ...
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
(Jan-26-2020, 05:35 PM)buran Wrote: do you have a file named discord.py? i.e. some file created by you around the time it stopped working ...
Ohw shit, yes i have created a file called discord.py. Should i delete it?

(Jan-26-2020, 06:04 PM)julio2000 Wrote:
(Jan-26-2020, 05:35 PM)buran Wrote: do you have a file named discord.py? i.e. some file created by you around the time it stopped working ...
Ohw shit, yes i have created a file called discord.py. Should i delete it?
omg just deleted it and it works again. Thanks a lot!!
Reply
#4
it was importing that file, not the package.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  qpython package error Creepy 4 942 Jul-06-2023, 05:58 PM
Last Post: Creepy
  pyarrow error when importing pandas sravva 1 881 Jun-06-2023, 05:09 PM
Last Post: snippsat
  ERROR: importing desired module mbgamer28 0 1,648 Apr-05-2021, 07:46 PM
Last Post: mbgamer28
  countryinfo package error MarcusAurelius 4 2,770 Mar-20-2021, 05:42 PM
Last Post: deanhystad
Bug Error while importing numpy Erfan 3 3,217 Nov-28-2020, 07:49 AM
Last Post: bowlofred
  error with netcdf4 package damdam 0 1,791 Nov-18-2020, 06:44 PM
Last Post: damdam
  Importing module from a package results in import error goghvv 2 2,340 Mar-27-2020, 07:13 PM
Last Post: goghvv
  Beginner - simple package installation error mefeng2008 0 1,697 Mar-13-2020, 09:17 AM
Last Post: mefeng2008
  Error in importing numpy fullstop 1 1,885 Dec-18-2019, 12:07 PM
Last Post: jefsummers
  Error in importing package in pycharm fullstop 0 2,311 Dec-12-2019, 04:03 PM
Last Post: fullstop

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020