cater for python-pil versions without close() attribute
This commit is contained in:
parent
23b77d2544
commit
486361e716
1 changed files with 5 additions and 1 deletions
|
@ -310,7 +310,11 @@ def convert(images, dpi=None, pagesize=(None, None), title=None, author=None,
|
||||||
imgdata = imgdata.convert('RGB')
|
imgdata = imgdata.convert('RGB')
|
||||||
color = imgdata.mode
|
color = imgdata.mode
|
||||||
img = imgdata.tobytes()
|
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)
|
imgdata = zlib.compress(img)
|
||||||
im.close()
|
im.close()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue