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


Groups > comp.lang.python > #7723

Re: Trapping MySQLdb warnings

Date 2011-06-15 18:38 -0800
From Tim Johnson <tim@johnsons-web.com>
Subject Re: Trapping MySQLdb warnings
References <20110616015837.GA1885@johnsons-web.com> <BANLkTint8YP9W7hUnvYh4nmMo_6h0WPXTA@mail.gmail.com>
Organization AkWebsoft
Newsgroups comp.lang.python
Message-ID <mailman.12.1308191913.1164.python-list@python.org> (permalink)

Show all headers | 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