From de214fe37bed7ba6484f7fbbf7a280d0eca76bee Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 25 Nov 2024 14:58:37 +0000 Subject: [PATCH] Manually import the shared library. --- src/leveldb/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/leveldb/__init__.py b/src/leveldb/__init__.py index f863499..ab60b56 100644 --- a/src/leveldb/__init__.py +++ b/src/leveldb/__init__.py @@ -1,5 +1,6 @@ from __future__ import annotations +import glob from typing import TYPE_CHECKING import collections.abc @@ -168,7 +169,8 @@ def _init() -> None: if sys.platform == "win32": os.add_dll_directory(path) else: - os.environ["PATH"] = os.environ.get("PATH", "") + os.pathsep + path + import ctypes + ctypes.cdll.LoadLibrary(glob.glob(os.path.join(glob.escape(path), "*leveldb_mcpe*"))[0]) from ._leveldb import init