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


Groups > comp.lang.python > #7723

Re: Trapping MySQLdb warnings

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!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.010
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'debug': 0.03; 'wed,': 0.03; 'warnings': 0.05; 'python': 0.08; 'linux.': 0.09; 'received:64.4': 0.09; 'pm,': 0.10; 'wrote:': 0.14; 'btw:': 0.16; 'looked': 0.16; 'header:In-Reply-To:1': 0.21; 'modification': 0.23; 'module,': 0.23; 'unsure': 0.23; 'code': 0.24; 'there.': 0.25; 'tried': 0.27; "i'm": 0.27; 'thanks': 0.28; 'module': 0.30; 'catching': 0.30; 'url:library': 0.31; 'does': 0.33; 'to:addr :python-list': 0.33; 'header:User-Agent:1': 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; 'comments': 0.39; 'skip:s 20': 0.39; 'should': 0.39; 'johnson': 0.39; 'printed': 0.39; 'to:addr:python.org': 0.39; 'getting': 0.40; 'forward': 0.62; 'subject': 0.62; 'world.': 0.65; 'day': 0.67; 'tomorrow.': 0.84; 'warning.': 0.84
Date Wed, 15 Jun 2011 18:38:29 -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>
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
In-Reply-To <BANLkTint8YP9W7hUnvYh4nmMo_6h0WPXTA@mail.gmail.com>
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.12.1308191913.1164.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 82.94.164.166
X-Trace 1308191913 news.xs4all.nl 49180 [::ffff:82.94.164.166]:52075
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:7723

Show key headers only | View raw


* 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.
<.....> 
> 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:
			std.mrk('',0,"mysql.py:196")  ## DEBUG call	
## and it does not look like my code modification
## is catching the warning.
Thanks for introducing me to this new module, but I'm not
sure if it is what I should be using.

BTW: End of day in this part of the world. I look forward to any other comments
on this subject tomorrow.
chees
-- 
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


Thread

Re: Trapping MySQLdb warnings Tim Johnson <tim@johnsons-web.com> - 2011-06-15 18:38 -0800

csiph-web