Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#61 PIL → pillow: changes to "import Image" required

PyX
closed
nobody
None
1
2013-07-12
2013-05-16
Stuart Prescott
No

Hi!

The PIL module looks like it is changing and this has consequences for pyx. A summary of the changes and how it affects packages was made by the Debian python maintainer:

http://lists.debian.org/5117D0B7.801@debian.org

There aren't a lot of places where PIL modules are imported, but eventually each of these will need to be changed to be compatible with the new layout.

pyx/mesh.py: import Image
pyx/mesh.py: import Image
pyx/epsfile.py: import Image
examples/bitmap/jpeg.txt: import Image
examples/bitmap/pil.py:import Image
contrib/imgconvert.py: import Image
contrib/epstopng.py:import Image # we use the python image library (PIL)

Fortunately, the change is quite trivial and backwards compatible:

import Image

becomes

try:
from PIL import Image
except ImportError:
import Image

(trying the new style import and then the old style import). In Debian and Ubuntu, the python-imaging-compat package will provide a temporary compatibility layer and I'll make the pyx packages depend on that compatibility layer for the time being.

I'm happy to throw a patch for this in your direction closer to the time when PIL changes hit the repository, but feel free to beat me to it if you so desire ;)

cheers
Stuart

Discussion

  • Andre Wobst
    Andre Wobst
    2013-05-28

    • status: open --> closed
     
  • Andre Wobst
    Andre Wobst
    2013-05-28

    Thanks for the report. We shall indeed support the PIL and pillow import style to ease live for our users and the package maintainers. I just submitted a fix in changeset 3353.