From 4e27059209473118142a5a220b002353dc82d3e4 Mon Sep 17 00:00:00 2001 From: sravan Date: Mon, 21 Oct 2024 01:50:29 +0530 Subject: [PATCH] [Core] Add error handling when [p]load tries to load "locales" (#6466) --- redbot/core/_cog_manager.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/redbot/core/_cog_manager.py b/redbot/core/_cog_manager.py index 9f195aa65c2..bd5f77fd01a 100644 --- a/redbot/core/_cog_manager.py +++ b/redbot/core/_cog_manager.py @@ -258,6 +258,12 @@ async def _find_core_cog(name: str) -> ModuleSpec: try: mod = import_module(real_name, package=package) + if mod.__spec__.name == "redbot.cogs.locales": + raise NoSuchCog( + "No core cog by the name of '{}' could be found.".format(name), + path=mod.__spec__.origin, + name=name, + ) except ImportError as e: if e.name == package + real_name: raise NoSuchCog(