Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'exception': 0.05; 'responding': 0.07; 'utf-8': 0.07; 'mess': 0.09; 'statements': 0.09; 'thrown': 0.09; 'python': 0.10; 'assume': 0.12; 'cases': 0.15; 'ascii,': 0.16; 'blanket': 0.16; 'catch-all': 0.16; 'file).': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'merely': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'raised,': 0.16; 'subject:exception': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'fix': 0.18; 'appears': 0.20; 'subject:problem': 0.22; 'trying': 0.22; 'posted': 0.23; '(you': 0.23; 'header:In-Reply-To:1': 0.23; 'error.': 0.24; "i've": 0.24; 'all.': 0.24; 'header:User-Agent:1': 0.26; '(which': 0.26; '(i.e.,': 0.27; 'error': 0.28; 'script': 0.28; 'skip:" 20': 0.28; 'catching': 0.29; 'received:192.168.1.3': 0.29; 'trace': 0.29; 'probably': 0.30; 'fixed': 0.30; 'am,': 0.30; 'chris': 0.31; 'there.': 0.31; 'raising': 0.33; 'running': 0.34; 'file': 0.34; "can't": 0.34; 'getting': 0.35; "i'll": 0.35; 'to:addr:python-list': 0.35; 'except': 0.35; 'goes': 0.35; 'really': 0.36; 'test': 0.36; 'character': 0.36; 'but': 0.36; 'subject:: ': 0.37; 'being': 0.37; 'self': 0.38; 'to:addr:python.org': 0.39; "won't": 0.39; 'files': 0.40; 'where': 0.40; 'whole': 0.60; 'hope': 0.62; 'it!': 0.64; 'reads': 0.66; 'header:Reply-To:1': 0.67; 'reply-to:no real name:2**0': 0.71; 'special': 0.74; 'reply-to:addr:python.org': 0.84 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.0 cv=KqrPKBqN c=1 sm=1 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=YsUzL_8ObRgA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=5Up8faWwAAAA:8 a=6G_HH38jRoibQcDHQE0A:9 a=wPNLvfGTeEIA:10 a=v6MMM96S_sUA:10 a=0nF1XD0wxitMEM03M9B4ZQ==:117 X-AUTH: mrabarnett:2500 Date: Tue, 26 Jun 2012 23:30:46 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: exception problem References: <4FE79433.8020704@earthlink.net> <4FE7982C.5020708@mrabarnett.plus.com> <4FE79FC9.5050404@earthlink.net> <4FE7F6CC.2050704@earthlink.net> <4FE803F8.3050207@gmail.com> <4FE8803C.3020108@earthlink.net> <4FEA0CC5.9050203@earthlink.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: python-list@python.org List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1340749856 news.xs4all.nl 6846 [2001:888:2000:d::a6]:33917 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:24488 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 > 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!