Skip navigation links

MySQL Forums :: Connector/Python :: How to trap warnings?


Advanced Search

How to trap warnings?
Posted by: Tim Johnson ()
Date: June 16, 2011 11:53AM

I'm using python 2.6 with the MySQLdb module.
Server version: 5.1.41-3ubuntu12.10 (Ubuntu)

In the past I have used _mysql_exceptions to raise exceptions for warnings.
Example
## instantiate cursor
self.__rdb = self.__conn.cursor()
## Execute a command 
try :
  self.__rdb.execute(command)
except _mysql_exceptions.Warning,e:
  ... ## exception handling here
But this approach does not appear to work any long
I'm just getting warnings of truncated data sent to stdout.
Please advise
TIA

Options: ReplyQuote


Subject Written By Posted
How to trap warnings? Tim Johnson 06/16/2011 11:53AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.