Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Random832 Newsgroups: comp.lang.python Subject: Re: Catch exception with message? Date: Fri, 03 Jun 2016 20:42:19 -0400 Lines: 12 Message-ID: References: <1465000939.1726478.627518305.3BB72ED4@webmail.messagingengine.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de /4igES6CTY0narP4ojjU5w3ITc32LhL7jpwUGQk/wrog== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.042 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'received:internal': 0.09; 'exception': 0.13; 'message-id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:10.202.2.212': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:io': 0.16; 'received:messagingengine.com': 0.16; 'received:psf.io': 0.16; 'subject:exception': 0.16; 'wrote:': 0.16; 'meant': 0.22; 'exceptions': 0.22; 'header:In-Reply-To:1': 0.24; 'fri,': 0.27; 'this.': 0.28; 'them?': 0.29; 'generally': 0.32; 'except': 0.34; 'but': 0.36; 'there': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'received:66': 0.38; 'to:addr:python.org': 0.40; 'subject:with': 0.40; 'your': 0.60; 'header:Message-Id:1': 0.61; 'different': 0.63; 'capture': 0.66; 'case?': 0.84; 'distinguish': 0.84; 'warning.': 0.84; 'subject:Catch': 0.91 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=ff4xc1cSQMxmSuC0gpum7v3koW0=; b=IdtEZs eZwrduEV2ecVUFjey3BMj3cbfDrMKw9CLz4T8B1nkYvHUhuI0/vH1WxJZMzWi43w h05JYpI7LlshY1wm7mN1fKl39tsuykjXUwTAYYjeNOKjPnq6HpU7X7TD9eg91dmQ DwtzY8syooMDGqk/xKtc5MkWodg26MOZpwamc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=ff4xc1cSQMxmSuC 0gpum7v3koW0=; b=B33+2oTyU2EFBKXu3wHDQRC3BbKQPADwRu8ionHs4dbmg73 y69g3OrmjyT5hW2ZAGtIUCJnQwLzovWg/kztuwWgB9N+mYT4hAl5dGsVWkPBS4/a ZRxjNDZIUYP0rkNjJIxqw9m4IqNnU9wC7OAX8ST4tcruRFTZC69xnSoYEr3g= X-Sasl-Enc: +1M8g06rg6C3iFlwg+qtb/49ea7b4rJCmctszEqeilfL 1465000939 X-Mailer: MessagingEngine.com Webmail Interface - ajax-38f217ef 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: <1465000939.1726478.627518305.3BB72ED4@webmail.messagingengine.com> X-Mailman-Original-References: Xref: csiph.com comp.lang.python:109446 On Fri, Jun 3, 2016, at 19:14, Piyush Verma 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. The message is meant to be human-readable, and may change without warning. Is there no other property on the exceptions you want to catch that can be used to distinguish them? (errno, perhaps?) What's your specific use case?