mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-29 18:53:22 +08:00
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.
This commit is contained in:
parent
aceb9a1a66
commit
c3754bd0c6
@ -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)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user