Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*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; 'examples': 0.12; 'exception': 0.12; 'wrote:': 0.14; 'see.': 0.16; 'working?': 0.16; 'looked': 0.16; 'header:In-Reply-To:1': 0.21; 'modification': 0.23; 'unsure': 0.23; 'code': 0.24; 'there.': 0.25; 'tried': 0.27; 'thanks': 0.28; 'skip:_ 20': 0.28; 'module': 0.30; 'catching': 0.30; 'far,': 0.30; 'url:library': 0.31; 'does': 0.33; 'to:addr :python-list': 0.33; "i've": 0.33; 'header:User-Agent:1': 0.35; 'module.': 0.35; 'using': 0.35; 'charset:us-ascii': 0.36; 'log': 0.36; '(to': 0.37; 'experiences': 0.37; 'url:docs': 0.37; 'url:python': 0.38; 'url:org': 0.38; 'but': 0.38; 'docs': 0.38; 'subject:: ': 0.38; 'some': 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; 'here.': 0.69; 'warning.': 0.84; 'absolutely': 0.98 Date: Thu, 16 Jun 2011 07:55:33 -0800 From: Tim Johnson To: python-list@python.org Subject: Re: Trapping MySQLdb warnings References: <20110616015837.GA1885@johnsons-web.com> <20110616023829.GB1885@johnsons-web.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110616023829.GB1885@johnsons-web.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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 30 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1308239732 news.xs4all.nl 49176 [::ffff:82.94.164.166]:58090 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:7747 * Tim Johnson [110615 18:53]: > * geremy condra [110615 18:03]: > > On Wed, Jun 15, 2011 at 6:58 PM, Tim Johnson 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. Well, I am so far, absolutely baffled. I've looked at the docs for the `warning' module. No real examples that I can see. and why has the _mysql_exceptions.Warning exception no longer working? grrr.. Be good to hear some other experiences here. thanks -- Tim tim at johnsons-web dot com or akwebsoft dot com http://www.akwebsoft.com