Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change load_library to return the paths of files that failed to load #646

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion wand/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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:
Expand Down