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

AttributeError exception due to backward incompatible change in Pillow 10.0.0 #33

Closed
Emily3403 opened this issue Sep 4, 2023 · 2 comments

Comments

@Emily3403
Copy link

This is essentially a copy of this issue of the original brother_ql repository.

If Pillow >= 10.0.0 is installed, the program fails with the following stacktrace:

Traceback (most recent call last):
  File "/home/emily/.local/bin/brother_ql", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/usr/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/emily/.local/lib/python3.11/site-packages/brother_ql/cli.py", line 146, in print_cmd
    instructions = convert(qlr=qlr, **kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/emily/.local/lib/python3.11/site-packages/brother_ql/conversion.py", line 113, in convert
    im = im.resize((dots_printable[0], hsize), Image.ANTIALIAS)
                                               ^^^^^^^^^^^^^^^
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

As recommended in this Stackoverflow post, the fix consists of renaming Image.ANTIALIAS to Image.LANCZOS.

This Pull Request already makes all the necessary changes for the original repo.

Currently, a fix is to force the old Pillow version with pip install --force-reinstall -v "Pillow==9.5.0", however I'd prefer if I was able to directly install and use the software.

Thanks and cheers in advance 😊

@matmair
Copy link
Owner

matmair commented Jun 20, 2024

Hi @Emily3403 I had notitifications of for this repo - no idea why - and did not see this till now.
This was addressed in #37 so updating the package should solve the issues. Please let me know if this works for you now.

@Emily3403
Copy link
Author

Seams to work fine, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants