Skip to content

Commit

Permalink
MIN Add deprecation error if FreeImage is used
Browse files Browse the repository at this point in the history
  • Loading branch information
luispedro committed May 2, 2024
1 parent 558a39b commit ae25704
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Unreleased
* io: Add deprecated warning for freeimage

Version 1.4.15 2024-04-17 by luispedro
* Update build system (thanks to @Czaki, see #147)

Expand Down
5 changes: 5 additions & 0 deletions mahotas/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ def error_imsave(*args, **kwargs):
from .pil import imread, imsave
except ImportError:
from .freeimage import imread, imsave
from os import environ
if 'MAHOTAS_NO_FREEIMAGE_DEPRECATION' not in environ:
import warnings
warnings.warn('mahotas.freeimage is deprecated. Please install the `imread` package')
warnings.warn('To suppress this warning, set the environment variable MAHOTAS_NO_FREEIMAGE_DEPRECATION')
# Importing freeimage can throw both ImportError and OSError, so check for both
except (OSError, ImportError): # pragma: no cover
import sys
Expand Down

0 comments on commit ae25704

Please sign in to comment.