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


Groups > comp.lang.python > #88774

Re: Exception Handling

Path csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.058
X-Spam-Evidence '*H*': 0.89; '*S*': 0.00; 'cc:addr:python-list': 0.11; 'python': 0.11; 'question.': 0.14; '*only*': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'responses.': 0.16; 'situation.': 0.16; 'sorts': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'otherwise,': 0.22; 'cc:addr:python.org': 0.22; 'decide': 0.24; 'file.': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; 'that.': 0.31; 'exceptions': 0.31; 'file': 0.32; 'run': 0.32; 'up.': 0.33; 'fri,': 0.33; 'received:google.com': 0.35; 'thanks': 0.36; 'should': 0.36; 'application': 0.37; 'pm,': 0.38; 'how': 0.40; 'catch': 0.60; 'kind': 0.63; 'more': 0.64; 'here': 0.66; 'reads': 0.68; '2015': 0.84; 'clauses,': 0.84; 'console,': 0.84; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=qQsdHbiOpIDlYvE6Y1y68dBhOexliT+lqFFei7q08xs=; b=iCQHUivzltH2a3Uvyz4v6htsFWqHN4PO4uSNGhrzeIzQz+EtZDUX7wVSJcj1hrG7g5 9VDsXZCuP62Bf72PIYQUHeCEopTUfSgCwUL+5vruqh8esVaBruRo0kZshOnlCxMYmrok jKNHsjZPYPz3EX0YltTq7Ixikwl1ofilSgVg0FczkFDGePPJ7SEkjjgvl0VWiOta7f2g 9EQ7rixdtzzz5184XqeDRfIX83FyszpzzVJp8tID+6742VbnnHbyHUmJ0THiacZxMuG6 s2G7Pp5aouj5L+C0rYZdNLKCD4KYMVDuPSZI+q42mSyvc6wpnUWMZP0IB2obqaK1BgQX MuUg==
MIME-Version 1.0
X-Received by 10.107.134.206 with SMTP id q75mr801269ioi.27.1428656401391; Fri, 10 Apr 2015 02:00:01 -0700 (PDT)
In-Reply-To <1cd0a97d-96c7-4ee6-9cfe-c0e90b9baa55@googlegroups.com>
References <b6461fc8-a18b-4d61-86f9-65370b0a149d@googlegroups.com> <1cd0a97d-96c7-4ee6-9cfe-c0e90b9baa55@googlegroups.com>
Date Fri, 10 Apr 2015 19:00:01 +1000
Subject Re: Exception Handling
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20
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>
Newsgroups comp.lang.python
Message-ID <mailman.199.1428656403.12925.python-list@python.org> (permalink)
Lines 13
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1428656403 news.xs4all.nl 2865 [2001:888:2000:d::a6]:45810
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:88774

Show key headers only | View raw


On Fri, Apr 10, 2015 at 6:39 PM, Palpandi <palpandi111@gmail.com> wrote:
> Thanks for your responses. And I have one more question.
>
> This is the situation. A python application which reads data from one .xml file and generates some other file. Here what kind of exceptions occur?

All sorts of exceptions. The best way to find out is to write your
code without any try/except clauses, and then run it. When an
exception happens, it'll be printed out on the console, and the
program terminated. Then you can decide how your program should cope
with that. Catch an exception *only* if you can actually deal with it
inside your code; otherwise, just let it bubble up.

ChrisA

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


Thread

Exception Handling Palpandi <palpandi111@gmail.com> - 2015-04-09 02:31 -0700
  Re: Exception Handling Chris Angelico <rosuav@gmail.com> - 2015-04-09 20:36 +1000
  Re: Exception Handling Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-04-10 01:05 +1000
  Re: Exception Handling dieter <dieter@handshake.de> - 2015-04-10 08:11 +0200
  Re: Exception Handling Palpandi <palpandi111@gmail.com> - 2015-04-10 01:39 -0700
    Re: Exception Handling Chris Angelico <rosuav@gmail.com> - 2015-04-10 19:00 +1000
    Re: Exception Handling dieter <dieter@handshake.de> - 2015-04-11 07:39 +0200

csiph-web