1
0
Fork 0
forked from josch/img2pdf

avoid catch-all except

This commit is contained in:
josch 2015-03-13 14:43:24 +01:00
parent 4968d58621
commit 18a41fc8df

View file

@ -233,11 +233,10 @@ def convert(images, dpi=None, pagesize=(None, None, None), title=None,
debug_out("Reading %s"%imfilename, verbose) debug_out("Reading %s"%imfilename, verbose)
try: try:
rawdata = imfilename.read() rawdata = imfilename.read()
im = cStringIO(rawdata) except AttributeError:
except:
with open(imfilename, "rb") as im: with open(imfilename, "rb") as im:
rawdata = im.read() rawdata = im.read()
im = cStringIO(rawdata) im = cStringIO(rawdata)
try: try:
imgdata = Image.open(im) imgdata = Image.open(im)
except IOError as e: except IOError as e: