mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-11 11:25:30 +08:00
BUG: Fix FreeImage Py3k compatibility [patch by Almar Klein].
This commit is contained in:
@@ -55,19 +55,22 @@ def load_freeimage():
|
||||
try:
|
||||
freeimage = loader.LoadLibrary(lib)
|
||||
break
|
||||
except Exception, e:
|
||||
except Exception:
|
||||
if lib not in bare_libs:
|
||||
# Don't record errors when it couldn't load the library from
|
||||
# a bare name -- this fails often, and doesn't provide any
|
||||
# useful debugging information anyway, beyond "couldn't find
|
||||
# library..."
|
||||
errors.append((lib, e))
|
||||
# Get exception instance in Python 2.x/3.x compatible manner
|
||||
e_type, e_value, e_tb = sys.exc_info()
|
||||
del e_tb
|
||||
errors.append((lib, e_value))
|
||||
|
||||
if freeimage is None:
|
||||
if errors:
|
||||
# No freeimage library loaded, and load-errors reported for some
|
||||
# candidate libs
|
||||
err_txt = ['%s:\n%s'%(l, e.message) for l, e in errors]
|
||||
err_txt = ['%s:\n%s'%(l, str(e.message)) for l, e in errors]
|
||||
raise OSError('One or more FreeImage libraries were found, but '
|
||||
'could not be loaded due to the following errors:\n'+
|
||||
'\n\n'.join(err_txt))
|
||||
|
||||
Reference in New Issue
Block a user