From 9842cca96a969be3441c6b2fc5b383ac24a237aa Mon Sep 17 00:00:00 2001 From: Vladimir Olteanu Date: Tue, 2 Dec 2025 14:48:33 +0200 Subject: [PATCH] Replace `pkgutil.find_loader` with `importlib.util.find_spec` pkgutil.find_loader no longer works on newer python versions --- pyang/repository.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyang/repository.py b/pyang/repository.py index 37c388b4..5e37dee4 100644 --- a/pyang/repository.py +++ b/pyang/repository.py @@ -79,8 +79,8 @@ def __init__(self, path="", use_env=True, no_path_recurse=False, # but the real location is `/usr/local` # if the package is installed with pip # this information can be easily retrieved - import pkgutil - if not pkgutil.find_loader('pip'): + import importlib + if not importlib.util.find_spec('pip'): break # abort search if pip is not installed # hack below to handle pip 10 internals