Trapping MySQLdb warnings
Tim Johnson
tim at johnsons-web.com
Thu Jun 16 15:13:11 EDT 2011
* Terry Reedy <tjreedy at udel.edu> [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
More information about the Python-list
mailing list