Python 找不到扩展名。Cogs discord.py
这是我的密码Python 找不到扩展名。Cogs discord.py,python,discord.py,discord.py-rewrite,Python,Discord.py,Discord.py Rewrite,这是我的密码 for filename in os.listdir('lib\commands'): if filename.endswith('.py'): client.load_extension(f'cogs.{filename[:-3]}') 我的错误: Exception has occurred: ExtensionNotFound Extension 'cogs.ping_clear' could not be loaded. File "C:\Users
for filename in os.listdir('lib\commands'):
if filename.endswith('.py'):
client.load_extension(f'cogs.{filename[:-3]}')
我的错误:
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]}')
发生异常:ExtensionNotFound
无法加载扩展“cogs.ping_clear”。
文件“C:\Users\sakch\Desktop\Bot\main.py”,第15行,在
client.load_扩展名(f'cogs.{filename[:-3]}')
您在
加载扩展中放置了错误的路径。您应该传递与os.listdir中相同的路径
os.listdir('lib\commands')中文件名的:
如果filename.endswith('.py'):
client.load_扩展名(f'lib.commands.{filename[:-3]}')
Plase,提供一个。