cater for python-pil versions without close() attribute

This commit is contained in:
josch 2015-03-07 02:59:12 +01:00
parent 23b77d2544
commit 486361e716

View file

@ -310,7 +310,11 @@ def convert(images, dpi=None, pagesize=(None, None), title=None, author=None,
imgdata = imgdata.convert('RGB')
color = imgdata.mode
img = imgdata.tobytes()
imgdata.close()
# the python-pil version 2.3.0-1ubuntu3 in Ubuntu does not have the close() method
try:
imgdata.close()
except AttributeError:
pass
imgdata = zlib.compress(img)
im.close()