Python Forum
Error importing package - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Error importing package (/thread-23992.html)



Error importing package - julio2000 - Jan-26-2020

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!


RE: Error importing package - buran - Jan-26-2020

do you have a file named discord.py? i.e. some file created by you around the time it stopped working ...


RE: Error importing package - julio2000 - Jan-26-2020

(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!!


RE: Error importing package - buran - Jan-26-2020

it was importing that file, not the package.