mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-10 05:34:36 +00:00
[#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:
parent
c9b0a278ca
commit
59de033523
@ -8,6 +8,7 @@
|
|||||||
# http://www.hardcoded.net/licenses/hs_license
|
# http://www.hardcoded.net/licenses/hs_license
|
||||||
|
|
||||||
import os.path as op
|
import os.path as op
|
||||||
|
import logging
|
||||||
|
|
||||||
from PyQt4.QtGui import QImage
|
from PyQt4.QtGui import QImage
|
||||||
import PIL.Image
|
import PIL.Image
|
||||||
@ -40,8 +41,12 @@ class File(fs.File):
|
|||||||
def _read_info(self, field):
|
def _read_info(self, field):
|
||||||
fs.File._read_info(self, field)
|
fs.File._read_info(self, field)
|
||||||
if field == 'dimensions':
|
if field == 'dimensions':
|
||||||
|
try:
|
||||||
im = PIL.Image.open(unicode(self.path))
|
im = PIL.Image.open(unicode(self.path))
|
||||||
self.dimensions = im.size
|
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):
|
def get_blocks(self, block_count_per_side):
|
||||||
image = QImage(unicode(self.path))
|
image = QImage(unicode(self.path))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user