Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ian Kelly Newsgroups: comp.lang.python Subject: Re: Catch exception with message? Date: Fri, 3 Jun 2016 18:25:18 -0600 Lines: 20 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de PW22XjlB2ufak9sq7KCmVAITcdiTfvK3wJobBOtlvVXg== 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; 'else:': 0.03; 'cc:addr :python-list': 0.09; 'e.args[0]': 0.09; 'received:209.85.218': 0.10; 'exception': 0.13; '2016': 0.16; 'cc:name:python': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:exception': 0.16; 'wrote:': 0.16; 'try:': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'header:In-Reply-To:1': 0.24; 'fri,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'this.': 0.28; 'raise': 0.29; 'url:mailman': 0.30; 'generally': 0.32; 'url:python': 0.33; 'url:listinfo': 0.34; 'except': 0.34; 'received:google.com': 0.35; 'something': 0.35; 'but': 0.36; 'there': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:209': 0.38; 'url:mail': 0.40; 'subject:with': 0.40; 'different': 0.63; 'capture': 0.66; 'to:none': 0.91; 'subject:Catch': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:cc; bh=m0ojwXumb+WtSiDMJLBHeIHfNZ92PC+Ot8mJkvozk58=; b=vF/wzTaxfN5iczrYujSCxGH2CnXIJGeAElTxT+OF3UumlQqqQrD1r8hNYAVrnX92k8 egRQ5p8TFhT+xQNReghUX6Yj2HBHBCYRv7MZZXNayVtZ16W7jHsHf1dwjTj7MRNpsyQQ wZucM48ZJu3Pdp6pyHBgs7NDHbSqDH2IlYeWChzEPcptkNZlsnKD4BbLRINb4A9pxkOO EDhFvfy1IzNeycmushWWMTMU2LR3LPBXpuB28U3pBnsqX/JBywophMr8gw7V9I3/QQWL Immwk/vOJKFOinzCN8i6OZAXXu8dVj1zE6LuKCDrVrtfvphNKXwZTlOYAmrKsqZKFqIg 78XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:cc; bh=m0ojwXumb+WtSiDMJLBHeIHfNZ92PC+Ot8mJkvozk58=; b=QEt8BMo6R9AvrVeeLvhTQC82RP5Btj5AY0UnNCjcpeTqF9xb7SzUrNM2L+xmMnZJ7k t6U46xebp8zYxKjdjhiTZnFg1O+K/75aoshwWRSLfS114/IIFYYwQkZ/3MhGZauQQbdi vLIt1E75RF31PJWA8/xnQUS/G2wFrWUEHJsHb5ax0wz3I7pB5Nyn+CytrqImXLGxAhei RTOtmlj5RRzu59n6dj4oMA0x5BdfQD0N7ai9ID0sSUDV2ilDi2yzFN8pe2f17Zf0hVHZ Zr4ieQJGjuemG62EDt7Qyxs2K00mw1irhihemtHemuFUjzt1wFA/mdmgjTfitobTaJFw ooJg== X-Gm-Message-State: ALyK8tK7DEbc1mzvl0jA+QnyoSAdpVstvdMaKBfdalWzWb5ilvNuoHvQM6gitq7GVhqbbWXi71mNBkkQtzN3hQ== X-Received: by 10.157.2.174 with SMTP id 43mr3223454otl.11.1464999958083; Fri, 03 Jun 2016 17:25:58 -0700 (PDT) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: Xref: csiph.com comp.lang.python:109445 try: something except Exception as e: if e.args[0] == message_of_interest: handle_it else: raise On Fri, Jun 3, 2016 at 5:14 PM, Piyush Verma <114piyush@gmail.com> wrote: > Generally we catch exception using > except Exception as e: > > But sometimes, we see same type of exception is present with different > message.Is there a way to capture same exception with message > filtering? Please help me to do this. > > Regards, > ~Piyush > -- > https://mail.python.org/mailman/listinfo/python-list