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: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'debug': 0.03; 'terry': 0.07; 'python': 0.08; 'question:': 0.09; 'received:64.4': 0.09; 'substitute': 0.09; 'cursor': 0.16; 'reedy': 0.16; 'result:': 0.16; 'class,': 0.16; 'header:In-Reply-To:1': 0.21; 'suspect': 0.25; 'object': 0.26; 'raise': 0.28; 'done': 0.32; 'to:addr :python-list': 0.33; 'header:User-Agent:1': 0.35; 'charset:us- ascii': 0.36; 'connection': 0.37; 'something': 0.37; 'but': 0.38; 'subject:: ': 0.38; 'skip:s 20': 0.39; 'itself.': 0.39; 'either': 0.39; 'to:addr:python.org': 0.39; 'monte': 0.84; 'warning.': 0.84 Date: Thu, 16 Jun 2011 11:13:11 -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> <20110616155533.GD1885@johnsons-web.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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: 22 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1308251593 news.xs4all.nl 49045 [::ffff:82.94.164.166]:41897 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:7762 * Terry Reedy [110616 10:50]: <...> > Substitute specific MySQLdb warning class, whatever it is, for Warning. Hmm! Consider the following code: try : self.__rdb.execute(S) raise MySQLdb.Warning('danger, danger Monte Python') ## just for grins except MySQLdb.Warning,e: std.debug("e",e,0,0,'mysql.py:195',0) ## DEBUG GLOBAL ## result: INSPECTING `e' (F:mysql.py:195): danger, danger Monte Python ## Question: Am I initializing the cursor to raise warnings? I *so* rusty at this, but I suspect that something needs to be done with either the instantiation of the 'parent' connection object or the cursor object itself. -- Tim tim at johnsons-web dot com or akwebsoft dot com http://www.akwebsoft.com