Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #43486
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ramit.prasad@jpmorgan.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'completeness': 0.07; '[0]': 0.09; 'main()': 0.09; 'received:155': 0.09; 'try:': 0.09; 'subject:question': 0.10; 'disclaimers': 0.16; 'disclaimers,': 0.16; 'err:': 0.16; 'from:addr:jpmorgan.com': 0.16; 'received:155.180': 0.16; 'received:155.180.234': 0.16; 'received:159': 0.16; 'received:159.53': 0.16; 'received:159.53.110': 0.16; 'received:bankone.net': 0.16; 'received:exchad.jpmchase.net': 0.16; 'received:jpmchase.com': 0.16; 'received:jpmchase.net': 0.16; 'received:svr.bankone.net': 0.16; 'securities,': 0.16; 'subject:exception': 0.16; 'subject:handling': 0.16; 'unexpected': 0.16; 'url:disclosures': 0.16; 'url:jpmorgan': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'module': 0.19; 'trying': 0.19; 'to:name:python-list@python.org': 0.22; 'error': 0.23; 'logging': 0.26; 'header:In-Reply-To:1': 0.27; "d'aprano": 0.31; 'steven': 0.31; 'trace': 0.31; 'received:169.254': 0.32; 'url:python': 0.33; 'except': 0.35; 'but': 0.35; 'accuracy': 0.36; 'url:org': 0.36; 'received:169': 0.37; 'url:library': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'information,': 0.61; 'purchase': 0.65; 'contact': 0.67; 'subject': 0.69; 'legal': 0.71; 'sale': 0.75; 'received:169.254.8': 0.84 |
| X-DKIM | OpenDKIM Filter v2.1.3 sj1.jpmchase.com r3CLUdVF028029 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpmorgan.com; s=smtpout; t=1365802239; bh=di4yjtI/CuMxqh/WTs+bx9CIiPS6K1gSzA6SHogZsEc=; h=From:To:Subject:Date:Message-ID:References:In-Reply-To: Content-Transfer-Encoding:MIME-Version:Content-Type; b=Uj/0GHoPaMpGHbhK9UqVubUuVg/yYyi8u7ubmKDLGxOx/rY0okTdY78oyyh1MHfAh lRBS+vDWUTuIf02tX6R0ZgeCnnHxzbPWmcsCcpGWpjyNaiqVbv6L4IxXiPmaig/1hQ 6N2pZlmEvvcdkgh0HuLKf6Z6za39c1LK5oGC98rg= |
| From | "Prasad, Ramit" <ramit.prasad@jpmorgan.com> |
| To | "python-list@python.org" <python-list@python.org> |
| Subject | RE: newbie question about confusing exception handling in urllib |
| Thread-Topic | newbie question about confusing exception handling in urllib |
| Thread-Index | AQHONTOovurcuReobU6dIhCO9kMyepjTHSug |
| Date | Fri, 12 Apr 2013 21:29:21 +0000 |
| References | <1ae3261b-078d-4362-abff-ea4471addd6a@googlegroups.com> <c395da30-c593-4aeb-960e-69bf98c31880@googlegroups.com> <51642e32$0$30003$c3e8da3$5496439d@news.astraweb.com> |
| In-Reply-To | <51642e32$0$30003$c3e8da3$5496439d@news.astraweb.com> |
| Accept-Language | en-US |
| Content-Language | en-US |
| X-MS-Has-Attach | |
| X-MS-TNEF-Correlator | |
| x-originating-ip | [10.67.79.47] |
| Content-Transfer-Encoding | base64 |
| MIME-Version | 1.0 |
| X-DLP-FWD | Yes |
| Content-Type | text/plain; charset="utf-8" |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.537.1365802247.3114.python-list@python.org> (permalink) |
| Lines | 17 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1365802247 news.xs4all.nl 2697 [2001:888:2000:d::a6]:36951 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:43486 |
Show key headers only | View raw
Steven D'Aprano wrote:
> try:
> main()
> except Exception as err:
> log(err)
> print("Sorry, an unexpected error has occurred.")
> print("Please contact support for assistance.")
> sys.exit(-1)
>
>
I like the traceback[0] module for logging last exception thrown.
See traceback.format_exc() or traceback.print_exc().
trace = traceback.format_exc()
log.error('I was trying to do <action>, but unexpected error.\n{0}'.format(trace))
[0] http://docs.python.org/2/library/traceback.html
~Ramit
This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
newbie question about confusing exception handling in urllib cabbar@gmail.com - 2013-04-09 04:41 -0700
Re: newbie question about confusing exception handling in urllib Peter Otten <__peter__@web.de> - 2013-04-09 14:19 +0200
Re: newbie question about confusing exception handling in urllib cabbar@gmail.com - 2013-04-09 06:19 -0700
Re: newbie question about confusing exception handling in urllib Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-09 15:05 +0000
Re: newbie question about confusing exception handling in urllib Chris Angelico <rosuav@gmail.com> - 2013-04-10 02:23 +1000
RE: newbie question about confusing exception handling in urllib "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2013-04-12 21:29 +0000
Re: newbie question about confusing exception handling in urllib Terry Jan Reedy <tjreedy@udel.edu> - 2013-04-09 10:19 -0400
Re: newbie question about confusing exception handling in urllib Ian Kelly <ian.g.kelly@gmail.com> - 2013-04-09 13:11 -0600
csiph-web