[#79 state:fixed] Wrapped PIL's IOError into a warning logging.

--HG--
extra : convert_revision : svn%3Ac306627e-7827-47d3-bdf0-9a457c9553a1/trunk%40258
This commit is contained in:
hsoft 2009-12-15 16:54:47 +00:00
parent c9b0a278ca
commit 59de033523
1 changed files with 7 additions and 2 deletions

View File

@ -8,6 +8,7 @@
# http://www.hardcoded.net/licenses/hs_license
import os.path as op
import logging
from PyQt4.QtGui import QImage
import PIL.Image
@ -40,8 +41,12 @@ class File(fs.File):
def _read_info(self, field):
fs.File._read_info(self, field)
if field == 'dimensions':
im = PIL.Image.open(unicode(self.path))
self.dimensions = im.size
try:
im = PIL.Image.open(unicode(self.path))
self.dimensions = im.size
except IOError:
self.dimensions = (0, 0)
logging.warning(u"Could not read image '%s'", unicode(self.path))
def get_blocks(self, block_count_per_side):
image = QImage(unicode(self.path))