Finesses the check of skimage.io

If on Anaconda and python3 and the scikit image version < 0.11, then
don't bother.  Otherwise, go back to prior try/except code for existance
of skimage.io and availability of freeimage backend, which fixes the
issue on Linux Mint.
This commit is contained in:
John Evans 2014-09-10 14:43:11 -04:00
commit 72093f05f8
3 changed files with 18 additions and 5 deletions

View file

@ -38,14 +38,19 @@ except:
# The Cinema2K/4K tests seem to need the freeimage backend to skimage.io
# in order to work.
# in order to work. Unfortunately, scikit-image/freeimage is about as wonky as
# it gets. Anaconda can get totally weirded out on versions up through 3.6.4
# on Python3 with scikit-image up through version 0.10.0.
NO_SKIMAGE_FREEIMAGE_SUPPORT = False
try:
import skimage
import skimage.io
if 'freeimage' in skimage.io.find_available_plugins(loaded=True).keys():
skimage.io.use_plugin('freeimage', 'imread')
NO_SKIMAGE_FREEIMAGE_SUPPORT = False
else:
if (((sys.hexversion >= 0x03000000) and
('Anaconda' in sys.version) and
(re.match('0.10', skimage.__version__)))):
NO_SKIMAGE_FREEIMAGE_SUPPORT = True
else:
skimage.io.use_plugin('freeimage', 'imread')
except ((ImportError, RuntimeError)):
NO_SKIMAGE_FREEIMAGE_SUPPORT = True

View file

@ -16,6 +16,10 @@ import unittest
import warnings
import numpy as np
try:
import skimage.io
except ImportError:
pass
from .fixtures import OPJ_DATA_ROOT, opj_data_file, read_image
from .fixtures import NO_READ_BACKEND, NO_READ_BACKEND_MSG

View file

@ -14,6 +14,10 @@ import unittest
import warnings
import numpy as np
try:
import skimage.io
except ImportError:
pass
from .fixtures import read_image, NO_READ_BACKEND, NO_READ_BACKEND_MSG
from .fixtures import OPJ_DATA_ROOT, NO_SKIMAGE_FREEIMAGE_SUPPORT