Re: Understanding and dealing with an exception

2012-10-14 Thread Mark Lawrence
On 14/10/2012 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

Re: Understanding and dealing with an exception

2012-10-14 Thread Terry Reedy
On 10/14/2012 4:20 AM, Mark Lawrence wrote: You've already had some advice so I'll just point out that a bare except is a bad idea as you wouldn't even be able to catch a user interrupt. Try (groan!) catching StandardError instead. There are some bare except:s in the stdlib, that adding

Re: Understanding and dealing with an exception

2012-10-14 Thread Mark Lawrence
On 14/10/2012 11:06, Terry Reedy wrote: On 10/14/2012 4:20 AM, Mark Lawrence wrote: You've already had some advice so I'll just point out that a bare except is a bad idea as you wouldn't even be able to catch a user interrupt. Try (groan!) catching StandardError instead. There are some bare

Re: Understanding and dealing with an exception

2012-10-14 Thread MRAB
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

Re: Understanding and dealing with an exception

2012-10-14 Thread Vincent Davis
Yes afile is the file name and extension, ifile is the full file name and path. Thanks Vincent On Sunday, October 14, 2012, MRAB wrote: 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

Understanding and dealing with an exception

2012-10-13 Thread Vincent Davis
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 try: im =

Re: Understanding and dealing with an exception

2012-10-13 Thread Chris Angelico
On Sun, Oct 14, 2012 at 3:23 PM, Vincent Davis vinc...@vincentdavis.net wrote: OverflowError: Python int too large to convert to C long line 266, in _maketile bytecount = read(channels * ysize * 2) Is the file over 2GB? Might be a limitation, more than a bug, and one that could possibly be

Re: Understanding and dealing with an exception

2012-10-13 Thread Vincent Davis
Oops, I was going to make note of the file size. 1.2MB Vincent On Sat, Oct 13, 2012 at 10:31 PM, Chris Angelico ros...@gmail.com wrote: On Sun, Oct 14, 2012 at 3:23 PM, Vincent Davis vinc...@vincentdavis.net wrote: OverflowError: Python int too large to convert to C long line 266, in

Re: Understanding and dealing with an exception

2012-10-13 Thread Chris Angelico
On Sun, Oct 14, 2012 at 3:36 PM, Vincent Davis vinc...@vincentdavis.net wrote: Oops, I was going to make note of the file size. 1.2MB Then I'd definitely declare the file bad; I don't know what the valid ranges for channels and ysize are, but my reading of that is that your file's completely

Re: Understanding and dealing with an exception

2012-10-13 Thread Vincent Davis
I can open it is and all looks good using Pixelmator (I don't have Photoshop installed). I don't think there is anything wrong with the image. Part of my question is a result of being new to actually using exceptions in my programs and dealing with the exceptions is a primary part of what I need

Re: Understanding and dealing with an exception

2012-10-13 Thread Chris Angelico
On Sun, Oct 14, 2012 at 4:01 PM, Vincent Davis vinc...@vincentdavis.net wrote: I can open it is and all looks good using Pixelmator (I don't have Photoshop installed). I don't think there is anything wrong with the image. Part of my question is a result of being new to actually using