Re: Understanding and dealing with an exception
On 2012-10-14 05:23, Vincent Davis wrote:
> I am working on a script to find bad image files. I am using PIL
> and specifically image.verify() I have a set of known to be bad image
> files to test. I also what to be able to test any file for example a
> .txt and deal with the exception.
> Currently my code is basically
> im = Image.open(ifile)
> print('Pil image.verify() failed: ' + afile)
> except IOError:
> print('PIL cannot identify image file: ' + afile)
> print("Unexpected error doing PIL.Image.open():", sys.exc_info())
I notice that you have both "ifile" and "afile". Is that correct?
|All times are GMT. The time now is 10:57 PM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.