From c3754bd0c632314ebbbed0138043d203d6e8ad64 Mon Sep 17 00:00:00 2001 From: Vishal Date: Thu, 25 Jul 2024 20:45:55 +0530 Subject: [PATCH] Fixing a bug related to plugin file names. Fixed a bug where plugins don't run due to them being named same as inbuilt module from standard library of python. --- src/assets/ba_data/python/babase/_general.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/assets/ba_data/python/babase/_general.py b/src/assets/ba_data/python/babase/_general.py index 8c6b0d16..20bb3b73 100644 --- a/src/assets/ba_data/python/babase/_general.py +++ b/src/assets/ba_data/python/babase/_general.py @@ -3,6 +3,7 @@ """Utility snippets applying to generic Python code.""" from __future__ import annotations +import sys import types import weakref import random @@ -79,6 +80,8 @@ def getclass(name: str, subclassof: type[T]) -> type[T]: splits = name.split('.') modulename = '.'.join(splits[:-1]) classname = splits[-1] + if modulename in sys.stdlib_module_names: + raise Exception(f'{modulename} is an inbuilt module.') module = importlib.import_module(modulename) cls: type = getattr(module, classname)