Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PIL attribute error on list and lambda column representations #218

Merged
merged 1 commit into from
Jan 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions meerkat/columns/lambda_column.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from meerkat.errors import ConcatWarning
from meerkat.tools.lazy_loader import LazyLoader

PIL = LazyLoader("PIL")
Image = LazyLoader("PIL.Image")


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -178,7 +178,7 @@ def _image_base64(im):

def _image_formatter(cell):
im = cell.get()
if isinstance(im, PIL.Image.Image):
if isinstance(im, Image.Image):
im.thumbnail((max_image_width, max_image_height))
return f'<img src="data:image/jpeg;base64,{_image_base64(im)}">'
else:
Expand Down
4 changes: 2 additions & 2 deletions meerkat/columns/list_column.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from meerkat.mixins.cloneable import CloneableMixin
from meerkat.tools.lazy_loader import LazyLoader

PIL = LazyLoader("PIL")
Image = LazyLoader("PIL.Image")


Representer.add_representer(abc.ABCMeta, Representer.represent_name)
Expand Down Expand Up @@ -76,7 +76,7 @@ def _image_base64(im):

def _image_formatter(cell):
im = cell
if isinstance(im, PIL.Image.Image):
if isinstance(im, Image.Image):
im.thumbnail((max_image_width, max_image_height))
return f'<img src="data:image/jpeg;base64,{_image_base64(im)}">'
else:
Expand Down