Added check for flush method existense for file-like object in tiffplugin setup

This commit is contained in:
Dmitry Yantsen 2015-08-28 14:59:29 +05:00
parent bbc6f7d6bb
commit a2b6b661d9

View File

@ -935,6 +935,8 @@ class TiffImageFile(ImageFile.ImageFile):
# flush the file descriptor, prevents error on pypy 2.4+ # flush the file descriptor, prevents error on pypy 2.4+
# should also eliminate the need for fp.tell for py3 # should also eliminate the need for fp.tell for py3
# in _seek # in _seek
# flush method may not exist for file-like object.
if hasattr(self.fp, 'flush'):
self.fp.flush() self.fp.flush()
except IOError: except IOError:
# io.BytesIO have a fileno, but returns an IOError if # io.BytesIO have a fileno, but returns an IOError if