google-gemini / generative-ai-python

The official Python library for the Google Gemini API
https://pypi.org/project/google-generativeai/
Apache License 2.0
1.62k stars 322 forks source link

Add PngImagePlugin to imports. #438

Closed mbanani closed 4 months ago

mbanani commented 4 months ago

Description of the change

Imports PIL.PngImagePlugin that was assumed to be loaded as part of PIL but isn't guaranteed to be loaded before this code is called.

Motivation

Adds an import statement to avoid an error when PIL is partially loaded resulting in the following error: AttributeError: module 'PIL' has no attribute 'PngImagePlugin'. This was already mentioned but not resolved in #178.

Type of change

Bug Fix

Checklist

Fixes: #178