Skip to content

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

@Emily3403

Description

@Emily3403

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 😊

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions