Skip to content

Commit

Permalink
Merge pull request #7576 from deliangyang/main
Browse files Browse the repository at this point in the history
Import plugins relative to the module
  • Loading branch information
radarhere authored Dec 14, 2023
2 parents 0ae1377 + b235aa9 commit ac1f10f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/PIL/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,11 @@ def init():
if _initialized >= 2:
return 0

parent_name = __name__.rpartition(".")[0]
for plugin in _plugins:
try:
logger.debug("Importing %s", plugin)
__import__(f"PIL.{plugin}", globals(), locals(), [])
__import__(f"{parent_name}.{plugin}", globals(), locals(), [])
except ImportError as e:
logger.debug("Image: failed to import %s: %s", plugin, e)

Expand Down

0 comments on commit ac1f10f

Please sign in to comment.