Skip to content

Commit

Permalink
warn if module is found but fails to import in PIL.features
Browse files Browse the repository at this point in the history
  • Loading branch information
nulano committed Mar 31, 2023
1 parent e971674 commit 3d4e9b1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/PIL/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ def check_module(feature):
try:
__import__(module)
return True
except ImportError:
except ModuleNotFoundError:
return False
except ImportError as ex:
warnings.warn(str(ex))
return False


Expand Down Expand Up @@ -145,7 +148,10 @@ def check_feature(feature):
try:
imported_module = __import__(module, fromlist=["PIL"])
return getattr(imported_module, flag)
except ImportError:
except ModuleNotFoundError:
return None
except ImportError as ex:
warnings.warn(str(ex))
return None


Expand Down

0 comments on commit 3d4e9b1

Please sign in to comment.