From f5a056cc2a03506c82dae70ae57c106f2fa55ff5 Mon Sep 17 00:00:00 2001 From: Eric Lam Date: Sat, 23 Dec 2023 19:49:30 -0800 Subject: [PATCH] change load_library to return the paths of files that failed to load --- wand/api.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wand/api.py b/wand/api.py index 2fcf4ddd..3028cfca 100644 --- a/wand/api.py +++ b/wand/api.py @@ -131,9 +131,15 @@ def load_library(): """ tried_paths = [] + found_files = [] for libwand_path, libmagick_path in library_paths(): if libwand_path is None or libmagick_path is None: continue + if os.path.isfile(libwand_path) is True: + found_files.append(libwand_path) + if libwand_path != libmagick_path: + if os.path.isfile(libmagick_path) is True: + found_files.append(libmagick_path) try: tried_paths.append(libwand_path) libwand = ctypes.CDLL(str(libwand_path)) @@ -145,7 +151,7 @@ def load_library(): except (IOError, OSError): continue return libwand, libmagick - raise IOError('cannot find library; tried paths: ' + repr(tried_paths)) + raise IOError('cannot find compatible library; tried paths: ' + repr(tried_paths) + ' and failed to load files: ' + repr(found_files)) try: