From a6b69228e8abcff377b48062a1d3b84382f46ae2 Mon Sep 17 00:00:00 2001 From: wulan17 Date: Fri, 4 Oct 2024 00:11:34 +0700 Subject: [PATCH] pyrofork: fix plugins loader error on windows Signed-off-by: wulan17 --- pyrogram/client.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pyrogram/client.py b/pyrogram/client.py index 5c7bde38..ecde9e01 100644 --- a/pyrogram/client.py +++ b/pyrogram/client.py @@ -881,15 +881,15 @@ class Client(Methods): root.replace(".", "/"), path.replace(".", "/") ) if handler is None: - exclude_plugins.append(module_path.replace("/", ".")) + exclude_plugins.append(module_path.replace("/", ".").replace("\\", ".")) else: - exclude_handlers[module_path.replace("/", ".")] = handler + exclude_handlers[module_path.replace("/", ".").replace("\\", ".")] = handler count = 0 if not include: for current_root, dirnames, filenames in os.walk(root.replace(".", "/")): - namespace = current_root.replace("/", ".") + namespace = current_root.replace("/", ".").replace("\\", ".") if "__pycache__" in namespace: continue if namespace in exclude_plugins: @@ -957,7 +957,7 @@ class Client(Methods): pass else: for path, handlers in include: - module_path = root.replace("/", ".") + "." + path + module_path = root.replace("/", ".").replace("\\", ".") + "." + path if self.is_excluded(exclude_plugins, module_path): log.warning( '[%s] [LOAD] Ignoring namespace "%s"', self.name, module_path @@ -978,7 +978,7 @@ class Client(Methods): if "__path__" in dir(module): for current_root, _, filenames in os.walk(module_path.replace(".", "/")): - namespace = current_root.replace("/", ".") + namespace = current_root.replace("/", ".").replace("\\", ".") if "__pycache__" in namespace: continue if namespace in exclude_plugins: