Skip to content

Conversation

mbanani
Copy link
Contributor

@mbanani mbanani commented Jul 5, 2024

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

  • I have performed a self-review of my code.
  • I have added detailed comments to my code where applicable.
  • I have verified that my change does not break existing code.
  • My PR is based on the latest changes of the main branch (if unsure, please run git pull --rebase upstream main).
  • I am familiar with the Google Style Guide for the language I have coded in.
  • I have read through the Contributing Guide and signed the Contributor License Agreement.

Fixes: #178

@github-actions github-actions bot added status:awaiting review PR awaiting review from a maintainer component:python sdk Issue/PR related to Python SDK labels Jul 5, 2024
@MarkDaoust MarkDaoust merged commit fb033db into google-gemini:main Jul 8, 2024
@github-actions github-actions bot removed the status:awaiting review PR awaiting review from a maintainer label Jul 8, 2024
@mbanani mbanani deleted the fix-pil-import-error branch July 8, 2024 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:python sdk Issue/PR related to Python SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AttributeError: module 'PIL' has no attribute 'PngImagePlugin' when running Gemini model on Windows 11

2 participants