Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'except:': 0.07; 'try:': 0.07; 'instance.': 0.09; 'instances.': 0.09; 'subject:error': 0.11; 'clause.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.17; '>>>': 0.18; 'feb': 0.19; 'followed': 0.20; '"",': 0.22; 'exceptions': 0.22; 'statement': 0.23; 'raise': 0.24; 'header:In-Reply-To:1': 0.25; '(most': 0.27; 'message-id:@mail.gmail.com': 0.27; 'division': 0.29; 'class': 0.29; 'classes': 0.30; 'file': 0.32; 'traceback': 0.33; 'zero': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85.220': 0.35; 'received:209.85': 0.35; 'except': 0.36; 'skip:z 10': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'more': 0.63; '2013': 0.84; 'thing,': 0.84; 'albert': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=oGn7La7B+D6IvQZYErlBbvHgVBj5731xcq6LKvbR3HE=; b=vIvY22G0aqMdxNwOPyCcD7ssj7LcVZWz+M+j/qTa4VHUCfFDFn3o4gl0/CzYRN8BqV WbBlKYnxzf/CI6W40QAzaOF9Y6T532MMrH2SA2y6pNfcrsiOPT4l+ADs7oPjKCaFa94s /8CU1LoIEkHPlcz2ViT3HwskSWJojZUKhtMaO1xUsOCSTm++HEXSRWMdQyEjTetlNLAf hjZP+Ohjx2b/rAF61Tyfc1KdVweytghB+SJlUKfwjiLK2A30gMHnkmTMf0JoNziqVvyg CtTva3R2S8aS7bKJZAqYHcGkvpcXJ7dYQhgr8og92fXLXt19O2WoRxavLIigmCZW9fqt NVRA== MIME-Version: 1.0 X-Received: by 10.58.50.7 with SMTP id y7mr22551779ven.24.1360050906646; Mon, 04 Feb 2013 23:55:06 -0800 (PST) In-Reply-To: References: <1360025881.32270.140661186861365.09CB02A5@webmail.messagingengine.com> Date: Tue, 5 Feb 2013 18:55:06 +1100 Subject: Re: error in except From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list 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: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1360050908 news.xs4all.nl 6961 [2001:888:2000:d::a6]:51303 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38173 On Tue, Feb 5, 2013 at 5:51 PM, Laxmikant Chitare wrote: > One more thing, apart from what Albert mentioned. > Exceptions must be classes or instances. In effect you cannot just do > 'raise'. 'raise' statement must be followed by a class or an instance. You can inside an except clause. >>> try: 1/0 except: print("I got an exception!") raise I got an exception! Traceback (most recent call last): File "", line 2, in 1/0 ZeroDivisionError: division by zero ChrisA