[Image-SIG] Image.open doesn't close file before raising IOError "cannot identify image file"
aut imagesig
imagesig@aut.mailshell.com
Wed, 26 Mar 2003 02:11:45 -0800
Hello,
If Image.open raises an IOError ("cannot identify image file"), it doesn't close the file.
For my own use I've added
fp.close( )
just before the error is thrown (Line 1507). Don't know if that's the best way, or if there might be any unforseen consequence. Seems to fix my specific problem; I am trying to delete the image immediately if it isn't identified:
try:
im = Image.open(filename)
except IOError:
os.remove(filename)
Everything else works great!
Thanks,
aut