Catch exception if shape file does not include a thumbnail.

This commit is contained in:
markus
2020-11-13 14:42:02 -08:00
committed by Markus Lampert
parent 074ad40338
commit b7a356cceb

View File

@@ -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):