Catch exception if shape file does not include a thumbnail.
This commit is contained in:
@@ -322,11 +322,14 @@ class ToolBit(object):
|
||||
path = findShape(obj.BitShape)
|
||||
if path:
|
||||
with open(path, 'rb') as fd:
|
||||
zf = zipfile.ZipFile(fd)
|
||||
pf = zf.open('thumbnails/Thumbnail.png', 'r')
|
||||
data = pf.read()
|
||||
pf.close()
|
||||
return data
|
||||
try:
|
||||
zf = zipfile.ZipFile(fd)
|
||||
pf = zf.open('thumbnails/Thumbnail.png', 'r')
|
||||
data = pf.read()
|
||||
pf.close()
|
||||
return data
|
||||
except KeyError:
|
||||
pass
|
||||
return None
|
||||
|
||||
def saveToFile(self, obj, path, setFile=True):
|
||||
|
||||
Reference in New Issue
Block a user