From 32943e191d4d9cb71e507b1f6e6af200e6bcd3ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 6 Dec 2021 18:26:37 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8=20Get=20rid=20of=20an=20"imp"=20de?= =?UTF-8?q?precation=20warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Our distutils import used to determine the current interpreter's site-packages directory caused an import warning. Switching to a different method of determining the path solved the error and is also way cleaner. Found here: https://stackoverflow.com/a/52638888 --- src/octoprint/plugin/core.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/octoprint/plugin/core.py b/src/octoprint/plugin/core.py index e4c8228d9..4c6d6e07c 100644 --- a/src/octoprint/plugin/core.py +++ b/src/octoprint/plugin/core.py @@ -907,13 +907,9 @@ class PluginManager(object): def _detect_python_environment(self): import sys - from distutils.command.install import install as cmd_install - from distutils.dist import Distribution + import sysconfig - cmd = cmd_install(Distribution()) - cmd.finalize_options() - - self._python_install_dir = cmd.install_lib + self._python_install_dir = sysconfig.get_path("purelib") self._python_prefix = os.path.realpath(sys.prefix) self._python_virtual_env = hasattr(sys, "real_prefix") or ( hasattr(sys, "base_prefix")