[英]Extension not found. Cogs discord.py
This is my code.这是我的代码。
for filename in os.listdir('lib\commands'):
if filename.endswith('.py'):
client.load_extension(f'cogs.{filename[:-3]}')
My error:我的错误:
Exception has occurred: ExtensionNotFound
Extension 'cogs.ping_clear' could not be loaded.
File "C:\Users\sakch\Desktop\Bot\main.py", line 15, in <module>
client.load_extension(f'cogs.{filename[:-3]}')
You're putting the wrong path in load_extension
.您在
load_extension
中输入了错误的路径。 You should pass the same path as in os.listdir
您应该传递与
os.listdir
相同的路径
for filename in os.listdir('lib\commands'):
if filename.endswith('.py'):
client.load_extension(f'lib.commands.{filename[:-3]}')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.