Cogs problembs

Hi, do you mind is the problem here? I really don’t understand. What should I do? Some solutions?


import discord
import os
from discord.extimport commands

client = commands.Bot(command\_prefix='!')

async def load(ctx, extension):
async def unload(ctx, extension):

for filenamein os.listdir('./cogs'):
if filename.endswith('.py'):


import discord
from discord.extimport commands

class Example(commands.Cog):

def \_\_init\_\_(self, client):
self.client = client

async def on_ready(self):
print("Bot is online.")

def setup(client):

C:\Users\Dani\PycharmProjects\BotDiscord\venv\Scripts\python.exe -m Bot.main
Traceback (most recent call last):
File “D:\Users\Dani\AppData\Local\Programs\Python\Python37\lib\”, line 193, in _run_module_as_main
“__main__”, mod_spec)
File “D:\Users\Dani\AppData\Local\Programs\Python\Python37\lib\”, line 85, in _run_code
exec(code, run_globals)
File “C:\Users\Dani\PycharmProjects\BotDiscord\Bot\”, line 15, in <module>
for filename in os.listdir(’./cogs’):
FileNotFoundError: [WinError 3] The system cannot find the path specified: ‘./cogs’

Process finished with exit code 1

This error:

FileNotFoundError: [WinError 3] The system cannot find the path specified: ‘./cogs’

is telling you that python cannot find the folder “./cogs”. Here is the code which is looking for it:

for filenamein os.listdir('./cogs'):

In python, paths are relative to the current working directory. I.e. whatever folder your Bot.main is sitting in, you need to have a “cogs” folder in there.

If you have absolutely no reason to have any cogs for your bot, then comment out the following lines:

for filename in os.listdir('./cogs'):
    if filename.endswith('.py'):

and the script will stop seeking for a “cogs” folder.

1 Like

I’m having the same issue. Couldn’t figure it out yet. Cogs folder is already inside where the main bot is but when I run the code it’s giving me an error saying " The system cannot find the path specified: ’ ./cogs’

Do you have another way ?

Okay so I was facing the same issue, and it didn’t resolve while the directory name was still cogs. Just rename the directory and open it, should work. Don’t understand the reason properly though!