openzoom / deepzoom.py

Python Deep Zoom Tools
http://openzoom.org/
Other
176 stars 74 forks source link

Use newer Pillow resampling filter constants. #27

Open lvonlanthen opened 1 year ago

lvonlanthen commented 1 year ago

With Pillow 10.0.0, PIL.Image.CUBIC and PIL.Image.ANTIALIAS were removed. Instead, PIL.Image.BICUBIC and PIL.Image.LANCZOS respectively should be used.

hlovdal commented 2 months ago

Without this fix, program fails like

$ python ./helloworld-dzi.py
Traceback (most recent call last):
  File "C:\github\deepzoom.py\examples\helloworld\helloworld-dzi.py", line 5, in <module>
    import deepzoom
  File "C:\github\deepzoom.py\venv\lib\site-packages\deepzoomtools-2.0.0-py3.10.egg\deepzoom\__init__.py", line 57, in <module>
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

With it it still failed

$ python ./helloworld-dzi.py
Traceback (most recent call last):
  File "C:\Python310\lib\urllib\request.py", line 1505, in open_local_file
    stats = os.stat(localfile)
FileNotFoundError: [WinError 3] The system cannot find the path specified: ''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\github\deepzoom.py\examples\helloworld\helloworld-dzi.py", line 20, in <module>
    creator.create(SOURCE, "output/helloworld.dzi")
  File "C:\github\deepzoom.py\venv\lib\site-packages\deepzoomtools-2.0.0-py3.10.egg\deepzoom\__init__.py", line 422, in create
  File "C:\github\deepzoom.py\venv\lib\site-packages\deepzoomtools-2.0.0-py3.10.egg\deepzoom\__init__.py", line 508, in f_retry
  File "C:\github\deepzoom.py\venv\lib\site-packages\deepzoomtools-2.0.0-py3.10.egg\deepzoom\__init__.py", line 504, in f_retry
  File "C:\github\deepzoom.py\venv\lib\site-packages\deepzoomtools-2.0.0-py3.10.egg\deepzoom\__init__.py", line 547, in safe_open
  File "C:\Python310\lib\urllib\request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Python310\lib\urllib\request.py", line 519, in open
    response = self._open(req, data)
  File "C:\Python310\lib\urllib\request.py", line 536, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "C:\Python310\lib\urllib\request.py", line 496, in _call_chain
    result = func(*args)
  File "C:\Python310\lib\urllib\request.py", line 1483, in file_open
    return self.open_local_file(req)
  File "C:\Python310\lib\urllib\request.py", line 1522, in open_local_file
    raise URLError(exp)
urllib.error.URLError: <urlopen error [WinError 3] The system cannot find the path specified: ''>

but at least it is a step in the right direction.