Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #24488
| Date | 2012-06-26 23:30 +0100 |
|---|---|
| From | MRAB <python@mrabarnett.plus.com> |
| Subject | Re: exception problem |
| References | (5 earlier) <4FE803F8.3050207@gmail.com> <4FE8803C.3020108@earthlink.net> <CAPTjJmpZwO21MPSHFUo0CC-kY=z+h+BMNvkNtzy5LQPP87HyHA@mail.gmail.com> <4FEA0CC5.9050203@earthlink.net> <CAPTjJmrUDR6jS+TuU3_vg-sudqAf51MJWG1O6JtRcHA_cfr5fw@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1532.1340749856.4697.python-list@python.org> (permalink) |
On 26/06/2012 22:36, Chris Angelico wrote: > (You posted privately to me again; I hope you don't mind my responding > on-list as this appears to have been merely oversight.) > > On Wed, Jun 27, 2012 at 5:25 AM, Charles Hixson > <charleshixsn@earthlink.net> wrote: >> Only thing is, this whole mess started when I was trying to trace down and >> expected error. (Which turned out to be "self.chunkLine(..." where self >> wasn't defined.) It was running without ANY error being displayed. Though >> as I look an outer loop is inclosed in a try:except:finally: It still has >> an unlabelled except, because I don't remember what exception is thrown when >> a file reads an unintelligible character (i.e., it isn't really a utf-8 >> file). Currently I've fixed all the files so that they're either utf-8 or >> just ASCII, so currently it isn't getting triggered, but it's still there. >> So that's probably the explanation. I think I'll fix that now. (I can, I >> guess, assume that any exception will be caught by except BasicException:) > > That's the problem, your blanket try/except. Don't do it! It blinds > you. Same goes for catching Exception or BaseException. Catch what you > really need to catch, and reserve catch-all statements for special > cases where you don't have access to the console. > If you can't remember what exception is raised, just try raising it deliberately. Python _can_ be used interactively, after all. Even a short script to test it won't take you very long!
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: exception problem MRAB <python@mrabarnett.plus.com> - 2012-06-26 23:30 +0100
csiph-web