Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #7760
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <tim@johnsons-web.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; 'wed,': 0.03; 'context': 0.04; 'ok.': 0.04; 'warnings': 0.05; 'terry': 0.07; 'python': 0.08; '>>>>': 0.09; 'exception.': 0.09; 'exceptions': 0.09; 'linux.': 0.09; 'received:64.4': 0.09; 'substitute': 0.09; 'pm,': 0.10; 'am,': 0.14; 'wrote:': 0.14; 'happens.': 0.16; 'objects?': 0.16; 'reedy': 0.16; 'class,': 0.16; 'stack': 0.16; 'looked': 0.16; 'header:In-Reply-To:1': 0.21; 'unsure': 0.23; 'there.': 0.25; 'classes': 0.26; 'tried': 0.27; 'thanks': 0.28; 'class': 0.29; 'module': 0.30; 'url:library': 0.31; 'properly': 0.32; 'to:addr:python-list': 0.33; "i'll": 0.34; 'first.': 0.34; 'header :User-Agent:1': 0.35; 'instances': 0.35; 'using': 0.35; 'charset :us-ascii': 0.36; 'log': 0.36; '(to': 0.37; 'url:docs': 0.37; 'url:python': 0.38; 'url:org': 0.38; 'but': 0.38; 'docs': 0.38; 'subject:: ': 0.38; 'skip:s 20': 0.39; 'should': 0.39; 'johnson': 0.39; 'printed': 0.39; 'to:addr:python.org': 0.39; 'getting': 0.40; 'manager,': 0.63; "'em": 0.84; 'warning.': 0.84 |
| Date | Thu, 16 Jun 2011 11:01:06 -0800 |
| From | Tim Johnson <tim@johnsons-web.com> |
| To | python-list@python.org |
| Subject | Re: Trapping MySQLdb warnings |
| References | <20110616015837.GA1885@johnsons-web.com> <BANLkTint8YP9W7hUnvYh4nmMo_6h0WPXTA@mail.gmail.com> <20110616023829.GB1885@johnsons-web.com> <20110616155533.GD1885@johnsons-web.com> <itdj4h$mrn$1@dough.gmane.org> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| In-Reply-To | <itdj4h$mrn$1@dough.gmane.org> |
| Organization | AkWebsoft |
| User-Agent | Mutt/1.5.20 (2009-06-14) |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| 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.31.1308250864.1164.python-list@python.org> (permalink) |
| Lines | 40 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1308250864 news.xs4all.nl 49179 [::ffff:82.94.164.166]:51078 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:7760 |
Show key headers only | View raw
* Terry Reedy <tjreedy@udel.edu> [110616 10:50]: > On 6/16/2011 11:55 AM, Tim Johnson wrote: > >* Tim Johnson<tim@johnsons-web.com> [110615 18:53]: > >>* geremy condra<debatem1@gmail.com> [110615 18:03]: > >>>On Wed, Jun 15, 2011 at 6:58 PM, Tim Johnson<tim@johnsons-web.com> wrote: > >>>>Using Python 2.6.5 on linux. > >>>> > >>>>When using MySQLdb I am getting warnings printed to stdout, but I would > >>>>like to trap, display and log those warnings. > >><.....> > > The machinery in the warnings module is only for instances of > subsclasses of Warning. Are the warnings from MySQLdb properly such > objects? If so, what class are they? The warnings are sent directly to stdout. No way that I know of to find out what classes they are.. > >>>Have you tried http://docs.python.org/library/warnings.html#temporarily-suppressing-warnings > >> Hi Geremy: > >> I just looked at the docs there. This is a new module (to me), and > >> I am unsure of the implementation or whether this is what I should > >> use. > >> I tried the following : > >> try : > >> self.__rdb.execute(S) > >> except warnings.catch_warnings: > > warnings.catch_warnings is a context manager, not an exception. Thanks for that. > This is a TypeError in 3.x, which requires that exceptions be > instances of BaseException. Try > except warnings.Warning, warn: > > Substitute specific MySQLdb warning class, whatever it is, for Warning. OK. I'll stack 'em up and see what happens. Must look at docs first. thanks again -- Tim tim at johnsons-web dot com or akwebsoft dot com http://www.akwebsoft.com
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Trapping MySQLdb warnings Tim Johnson <tim@johnsons-web.com> - 2011-06-16 11:01 -0800
csiph-web