Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #109444

Catch exception with message?

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Piyush Verma <114piyush@gmail.com>
Newsgroups comp.lang.python
Subject Catch exception with message?
Date Sat, 4 Jun 2016 04:44:30 +0530
Lines 9
Message-ID <mailman.138.1464995679.1839.python-list@python.org> (permalink)
References <CAJV9OM_eDYJHsq1J7N9mYQEyqRsUR1S7LOJWZ8+XGEJ_h3CHYw@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de Rmnc+hU1346KqdhBhknrCwkIdMBmvn9W57OT09QLTxfg==
Return-Path <114piyush@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.094
X-Spam-Evidence '*H*': 0.82; '*S*': 0.00; 'received:209.85.213.46': 0.07; 'exception': 0.13; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:exception': 0.16; 'message-id:@mail.gmail.com': 0.27; 'this.': 0.28; 'generally': 0.32; 'except': 0.34; 'received:google.com': 0.35; 'but': 0.36; 'there': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'received:209.85.213': 0.37; 'received:209': 0.38; 'to:addr:python.org': 0.40; 'subject:with': 0.40; 'different': 0.63; 'capture': 0.66; 'subject:Catch': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=1sJWS61JrrO5V821T+yo4R8rMNwTZDzV6HJTApEOuz0=; b=VzPhrPbIm7P+6OCMGXX9JEDKKOU+73kmHIjfAx/h4fSGUsnqVcEZRbOCIHLyBwdHR0 H0sIy65Ck03BVHXo/Mwjxqc1sspdGa9cRj3ZmjNj+0VyNhPPquRghTjWB2JrgaErWwpq PgNCSfEt6N7ovY+ipjl+RuCL3Y4jom6jRNQgias/j7I4avEDCsITIUCCEovjcAMr2jAQ gXD2G2n2iY8EyrLd/pm2T8/Kzp10uclD8NGQVHEmcbWbgTOeNAPoEU2pZ3v0bPlRHXUY RffnDbM153Bonww1ezgKISQUEz9NaLyLsGEtr2IhHxx/cCJjGnlJpmqMUsQ0aPY1YZUF Kq9A==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=1sJWS61JrrO5V821T+yo4R8rMNwTZDzV6HJTApEOuz0=; b=HBiq1XB3GJu2YfTiD0LT20uMOcdzGdzGXiouHZnTfGQV+g187qlDnslMr8ejiuQTTk EVAfQ8eOPfmKWEEWd68Clo7mypn6k/Fq7f+bitjpIUsB8OaIgTYKZM7oAvKuAaCmsKpG D005USfxMnoggOZrho4L1dfZabstCd9/nwtrmLbDrVawEp5JDMj13IPupWiu1f8aiZ0n fUlekAHAq+27kgRDoLCupYwFFcvrS0B+tjHF7O1D2J7cHbG52vXhftHZUiUu15PMrikl HHnKcwr7Z3Gy5I4A6wiy/cWlyzFWI9J3PucJuzvMxZZJfLhCibcdiilqLGtX7CkrWkFg BzdQ==
X-Gm-Message-State ALyK8tKf9f5t1OApgX2LznCg4fKaLD1YZweMMpRb201sWSdPF0GwDJQMs+9kfFGzDX7NEMtTpOcukfBQqcQ9WQ==
X-Received by 10.31.156.198 with SMTP id f189mr2950956vke.11.1464995670824; Fri, 03 Jun 2016 16:14:30 -0700 (PDT)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <CAJV9OM_eDYJHsq1J7N9mYQEyqRsUR1S7LOJWZ8+XGEJ_h3CHYw@mail.gmail.com>
Xref csiph.com comp.lang.python:109444

Show key headers only | View raw


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

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Catch exception with message? Piyush Verma <114piyush@gmail.com> - 2016-06-04 04:44 +0530
  Re: Catch exception with message? Steven D'Aprano <steve@pearwood.info> - 2016-06-04 12:38 +1000
  Re: Catch exception with message? Peter Pearson <pkpearson@nowhere.invalid> - 2016-06-04 16:44 +0000
    Re: Catch exception with message? Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-04 16:39 -0700

csiph-web